diff options
author | evgen@moonbone.local <> | 2007-04-07 00:13:27 +0400 |
---|---|---|
committer | evgen@moonbone.local <> | 2007-04-07 00:13:27 +0400 |
commit | 93c29c10b1ad5a8f05d796e1a6ba8ca99652895b (patch) | |
tree | 39b77b60e33f6568dac86227150426c517f5d047 /mysql-test | |
parent | 54bc9c3d779e659f101f317d1925b7fd95064064 (diff) | |
download | mariadb-git-93c29c10b1ad5a8f05d796e1a6ba8ca99652895b.tar.gz |
Bug#27586: Wrong autoinc value assigned by LOAD DATA in the
NO_AUTO_VALUE_ON_ZERO mode.
The table->auto_increment_field_not_null variable wasn't reset after
reading a row which may lead to inserting a wrong value to the auto-increment
field to the following row.
The table->auto_increment_field_not_null variable is reset now right after a
row is being written in the read_fixed_length() and the read_sep_field()
functions.
Removed wrong setting of the table->auto_increment_field_not_null variable in
the read_sep_field() function.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/loaddata.result | 9 | ||||
-rw-r--r-- | mysql-test/t/loaddata.test | 16 |
2 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index bef483569d4..0478e48025f 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -156,3 +156,12 @@ select load_file("MYSQL_TEST_DIR/t/loaddata.test"); load_file("MYSQL_TEST_DIR/t/loaddata.test") NULL drop table t1, t2; +create table t1(f1 int); +insert into t1 values(1),(null); +create table t2(f2 int auto_increment primary key); +select * from t2; +f2 +1 +2 +SET @@SQL_MODE=@OLD_SQL_MODE; +drop table t1,t2; diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 125a65826ca..e6788cd7798 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -136,4 +136,20 @@ eval select load_file("$MYSQL_TEST_DIR/t/loaddata.test"); # cleanup drop table t1, t2; +# +# Bug#27586: Wrong autoinc value assigned by LOAD DATA in the +# NO_AUTO_VALUE_ON_ZERO mode +# +create table t1(f1 int); +insert into t1 values(1),(null); +create table t2(f2 int auto_increment primary key); +disable_query_log; +eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t1' from t1; +SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO; +eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t2; +enable_query_log; +select * from t2; +--exec rm $MYSQLTEST_VARDIR/tmp/t1 +SET @@SQL_MODE=@OLD_SQL_MODE; +drop table t1,t2; # End of 5.0 tests |