diff options
author | unknown <evgen@moonbone.local> | 2007-02-09 22:25:09 +0300 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2007-02-09 22:25:09 +0300 |
commit | dd6feec4f40e89ae7d830b0a15d009ea2e66759e (patch) | |
tree | 5de1750759adba44229208a231218412005757ec /mysql-test/t/insert_select.test | |
parent | d4b4952f8b8e470fc68aea2cf2f91c1dc9b6452f (diff) | |
download | mariadb-git-dd6feec4f40e89ae7d830b0a15d009ea2e66759e.tar.gz |
Bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were
inserted.
The select_insert::send_eof() function now resets LAST_INSERT_ID variable if
no rows were inserted.
mysql-test/t/insert_select.test:
Added a test case for bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were inserted.
mysql-test/r/insert_select.result:
Added a test case for bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were inserted.
sql/sql_insert.cc:
Bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were
inserted.The select_insert::send_eof() function now resets LAST_INSERT_ID variable if
no rows were inserted.
Diffstat (limited to 'mysql-test/t/insert_select.test')
-rw-r--r-- | mysql-test/t/insert_select.test | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index 6302d5f1dae..5c60fc8e1f0 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -279,3 +279,16 @@ insert into t1 values (1,1) on duplicate key update f2=2; --disable_info select * from t1; drop table t1; + +# +# Bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT if no rows +# were inserted. +# +create table t1(f1 int primary key auto_increment, f2 int unique); +insert into t1(f2) values(1); +select @@identity; +insert ignore t1(f2) values(1); +select @@identity; +insert ignore t1(f2) select 1; +select @@identity; +drop table t1; |