Commit 96099750 authored by unknown's avatar unknown

Manually merged


mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/archive.result:
  Auto merged
mysql-test/r/auto_increment.result:
  Auto merged
mysql-test/r/func_time.result:
  Auto merged
mysql-test/r/ndb_lock.result:
  Auto merged
mysql-test/r/rpl_log.result:
  Auto merged
mysql-test/r/select.result:
  Auto merged
mysql-test/t/archive.test:
  Auto merged
mysql-test/t/auto_increment.test:
  Auto merged
mysql-test/t/func_time.test:
  Auto merged
mysql-test/t/ndb_lock.test:
  Auto merged
mysql-test/t/rpl_log.test:
  Auto merged
mysql-test/t/select.test:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/item_timefunc.h:
  Auto merged
sql/sql_lex.cc:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
parents 1ee952ec 6b8b4816
...@@ -6254,6 +6254,7 @@ auto fld1 companynr fld3 fld4 fld5 fld6 ...@@ -6254,6 +6254,7 @@ auto fld1 companynr fld3 fld4 fld5 fld6
3 011402 37 Romans scholastics jarring 3 011402 37 Romans scholastics jarring
4 011403 37 intercepted audiology tinily 4 011403 37 intercepted audiology tinily
DELETE FROM t2; DELETE FROM t2;
ERROR HY000: Table storage engine for 't2' doesn't have this option
SELECT * FROM t2; SELECT * FROM t2;
auto fld1 companynr fld3 fld4 fld5 fld6 auto fld1 companynr fld3 fld4 fld5 fld6
1 000001 00 Omaha teethe neat 1 000001 00 Omaha teethe neat
...@@ -8685,6 +8686,7 @@ auto fld1 companynr fld3 fld4 fld5 fld6 ...@@ -8685,6 +8686,7 @@ auto fld1 companynr fld3 fld4 fld5 fld6
3 011402 37 Romans scholastics jarring 3 011402 37 Romans scholastics jarring
4 011403 37 intercepted audiology tinily 4 011403 37 intercepted audiology tinily
TRUNCATE TABLE t2; TRUNCATE TABLE t2;
ERROR HY000: Table storage engine for 't2' doesn't have this option
SELECT * FROM t2; SELECT * FROM t2;
auto fld1 companynr fld3 fld4 fld5 fld6 auto fld1 companynr fld3 fld4 fld5 fld6
1 000001 00 Omaha teethe neat 1 000001 00 Omaha teethe neat
......
...@@ -378,6 +378,28 @@ t1 CREATE TABLE `t1` ( ...@@ -378,6 +378,28 @@ t1 CREATE TABLE `t1` (
KEY `t1_name` (`t1_name`) KEY `t1_name` (`t1_name`)
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 ) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
DROP TABLE `t1`; DROP TABLE `t1`;
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;
a t1a
1 1
2 1
3 2
4 2
5 2
6 3
7 3
8 3
9 3
drop table t1, t2;
End of 4.1 tests End of 4.1 tests
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)); CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`));
insert into t1 (b) values (1); insert into t1 (b) values (1);
......
...@@ -101,3 +101,20 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File ...@@ -101,3 +101,20 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 510 # # master-bin.000002 Yes Yes 0 0 510 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000002 510 # # master-bin.000002 Yes Yes 0 0 510 # None 0 No #
show binlog events in 'slave-bin.000005' from 4; show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
create table t1(a int auto_increment primary key, b int);
insert into t1 values (NULL, 1);
reset master;
set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.000001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
slave-bin.000001 79 Intvar 2 79 LAST_INSERT_ID=1
slave-bin.000001 107 Intvar 2 107 INSERT_ID=5
slave-bin.000001 135 Query 2 135 use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id())
select * from t1;
a b
1 1
5 1
6 1
drop table t1;
...@@ -1330,12 +1330,14 @@ SELECT * FROM t2; ...@@ -1330,12 +1330,14 @@ SELECT * FROM t2;
# #
# For bug #12836 # For bug #12836
# Delete was allowing all rows to be removed # Delete was allowing all rows to be removed
--error 1031
DELETE FROM t2; DELETE FROM t2;
SELECT * FROM t2; SELECT * FROM t2;
INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W'); INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring',''); INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily',''); INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
SELECT * FROM t2; SELECT * FROM t2;
--error 1031
TRUNCATE TABLE t2; TRUNCATE TABLE t2;
SELECT * FROM t2; SELECT * FROM t2;
......
...@@ -238,6 +238,23 @@ SHOW CREATE TABLE `t1`; ...@@ -238,6 +238,23 @@ SHOW CREATE TABLE `t1`;
DROP 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 --echo End of 4.1 tests
# #
......
...@@ -109,5 +109,19 @@ show slave status; ...@@ -109,5 +109,19 @@ show slave status;
--error 1220 --error 1220
show binlog events in 'slave-bin.000005' from 4; show binlog events in 'slave-bin.000005' from 4;
#
# Bug #6880: LAST_INSERT_ID() within a statement
#
create table t1(a int auto_increment primary key, b int);
insert into t1 values (NULL, 1);
reset master;
set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
--replace_result $VERSION VERSION
show binlog events;
select * from t1;
drop table t1;
# End of 4.1 tests # End of 4.1 tests
# Adding comment for force manual merge 5.0 -> wl1012: Delete me # Adding comment for force manual merge 5.0 -> wl1012: Delete me
...@@ -1131,7 +1131,7 @@ int ha_archive::end_bulk_insert() ...@@ -1131,7 +1131,7 @@ int ha_archive::end_bulk_insert()
int ha_archive::delete_all_rows() int ha_archive::delete_all_rows()
{ {
DBUG_ENTER("ha_archive::delete_all_rows"); DBUG_ENTER("ha_archive::delete_all_rows");
DBUG_RETURN(0); DBUG_RETURN(HA_ERR_WRONG_COMMAND);
} }
/* /*
......
...@@ -3288,6 +3288,7 @@ longlong Item_func_last_insert_id::val_int() ...@@ -3288,6 +3288,7 @@ longlong Item_func_last_insert_id::val_int()
{ {
THD *thd= current_thd; THD *thd= current_thd;
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
THD* thd= current_thd;
if (arg_count) if (arg_count)
{ {
longlong value= args[0]->val_int(); longlong value= args[0]->val_int();
...@@ -3296,7 +3297,7 @@ longlong Item_func_last_insert_id::val_int() ...@@ -3296,7 +3297,7 @@ longlong Item_func_last_insert_id::val_int()
return value; // Avoid side effect of insert_id() return value; // Avoid side effect of insert_id()
} }
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
return thd->insert_id(); return thd->last_insert_id_used ? thd->current_insert_id : thd->insert_id();
} }
/* This function is just used to test speed of different functions */ /* This function is just used to test speed of different functions */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment