mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge gbichot3.local:/home/mysql_src/mysql-5.1-interval-move-next-insert-id
into gbichot3.local:/home/mysql_src/mysql-5.1
This commit is contained in:
@ -117,6 +117,14 @@ insert into t1 (last_id) values (bug15728());
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
5
|
||||
drop procedure if exists foo;
|
||||
create procedure foo()
|
||||
begin
|
||||
declare res int;
|
||||
insert into t2 (last_id) values (bug15728());
|
||||
insert into t1 (last_id) values (bug15728());
|
||||
end|
|
||||
call foo();
|
||||
select * from t1;
|
||||
id last_id
|
||||
1 0
|
||||
@ -124,13 +132,64 @@ id last_id
|
||||
3 2
|
||||
4 1
|
||||
5 4
|
||||
6 3
|
||||
select * from t2;
|
||||
id last_id
|
||||
1 3
|
||||
2 4
|
||||
3 5
|
||||
select * from t1;
|
||||
id last_id
|
||||
1 0
|
||||
2 1
|
||||
3 2
|
||||
4 1
|
||||
5 4
|
||||
6 3
|
||||
select * from t2;
|
||||
id last_id
|
||||
1 3
|
||||
2 4
|
||||
3 5
|
||||
drop function bug15728;
|
||||
drop function bug15728_insert;
|
||||
drop procedure foo;
|
||||
drop table t1;
|
||||
truncate table t2;
|
||||
create table t1 (id tinyint primary key);
|
||||
create function insid() returns int
|
||||
begin
|
||||
insert into t2 (last_id) values (0);
|
||||
return 0;
|
||||
end|
|
||||
set sql_log_bin=0;
|
||||
insert into t2 (id) values(1),(2),(3);
|
||||
delete from t2;
|
||||
set sql_log_bin=1;
|
||||
select insid();
|
||||
insid()
|
||||
0
|
||||
set sql_log_bin=0;
|
||||
insert into t2 (id) values(5),(6),(7);
|
||||
delete from t2 where id>=5;
|
||||
set sql_log_bin=1;
|
||||
insert into t1 select insid();
|
||||
select * from t1;
|
||||
id
|
||||
0
|
||||
select * from t2;
|
||||
id last_id
|
||||
4 0
|
||||
8 0
|
||||
select * from t1;
|
||||
id
|
||||
0
|
||||
select * from t2;
|
||||
id last_id
|
||||
4 0
|
||||
8 0
|
||||
drop table t1, t2;
|
||||
drop function insid;
|
||||
create table t1 (n int primary key auto_increment not null,
|
||||
b int, unique(b));
|
||||
set sql_log_bin=0;
|
||||
|
Reference in New Issue
Block a user