From febe7eb64a7472823294ae7295194af2be1b3497 Mon Sep 17 00:00:00 2001 From: unknown <ramil@mysql.com> Date: Wed, 7 Jun 2006 14:01:10 +0500 Subject: Fix for bug #6880: LAST_INSERT_ID() within a statement mysql-test/r/auto_increment.result: Fix for bug #6880: LAST_INSERT_ID() within a statement - test result mysql-test/r/rpl_log.result: Fix for bug #6880: LAST_INSERT_ID() within a statement - test result mysql-test/t/auto_increment.test: Fix for bug #6880: LAST_INSERT_ID() within a statement - test case mysql-test/t/rpl_log.test: Fix for bug #6880: LAST_INSERT_ID() within a statement - test case sql/item_func.cc: Fix for bug #6880: LAST_INSERT_ID() within a statement - return the first thd->last_insert_id set (within a query) --- mysql-test/t/auto_increment.test | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'mysql-test/t/auto_increment.test') diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index eed2ea44d05..37b92b32bfb 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -238,4 +238,21 @@ SHOW CREATE TABLE `t1`; DROP TABLE `t1`; +# +# Bug #6880: LAST_INSERT_ID() within a statement +# + +create table t1(a int not null auto_increment primary key); +create table t2(a int not null auto_increment primary key, t1a int); +insert into t1 values(NULL); +insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()); +insert into t1 values (NULL); +insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()), +(NULL, LAST_INSERT_ID()); +insert into t1 values (NULL); +insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()), +(NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()); +select * from t2; +drop table t1, t2; + --echo End of 4.1 tests -- cgit v1.2.1