Re: LOAD DATA, /N, and auto_increment

Re: LOAD DATA, /N, and auto_increment

am 20.08.2002 10:30:13 von Michael Widenius

Hi!

>>>>> "Benjamin" == Benjamin Pflugmann writes:



Benjamin> How-to-repeat:

shell> cat >/tmp/in < Benjamin> 1
Benjamin> 2
Benjamin> \N
Benjamin> \N
Benjamin> 10
Benjamin> \N
Benjamin> EOF
shell> chmod a+r /tmp/in

mysql> CREATE TABLE ntest2 ( a INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY );
mysql> LOAD DATA INFILE '/tmp/in' INTO TABLE ntest2;
Benjamin> Query OK, 6 rows affected (0.00 sec)
Benjamin> Records: 6 Deleted: 0 Skipped: 0 Warnings: 3
mysql> SELECT * FROM ntest2;
Benjamin> +----+
Benjamin> | a |
Benjamin> +----+
Benjamin> | 1 |
Benjamin> | 2 |
Benjamin> | 3 |
Benjamin> | 4 |
Benjamin> | 10 |
Benjamin> | 11 |
Benjamin> +----+
Benjamin> 6 rows in set (0.00 sec)

Benjamin> As said above, the shown output differs from the expected in the
Benjamin> "Warnings: 3" message. There should be 0 warnings.

Here is a patch for this (will be in 4.0.3)

((/my/mysql-4.0)) bk diffs -c sql/sql_load.cc
===== sql/sql_load.cc 1.36 vs edited =====
*** /tmp/sql_load.cc-1.36-13800 Tue Jul 23 18:31:17 2002
--- edited/sql/sql_load.cc Tue Aug 20 11:50:37 2002
***************
*** 430,436 ****
{
if (field->type() == FIELD_TYPE_TIMESTAMP)
((Field_timestamp*) field)->set_time();
! else
thd->cuted_fields++;
}
continue;
--- 430,436 ----
{
if (field->type() == FIELD_TYPE_TIMESTAMP)
((Field_timestamp*) field)->set_time();
! else if (field != table->next_number_field)
thd->cuted_fields++;
}
continue;

Regards,
Monty

------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread12380@lists.mysql.com
To unsubscribe, e-mail