mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
LAST_INSERT_ID() should not be set if we couldn't generate an auto_increment id.
This commit is contained in:
@ -111,11 +111,16 @@ insert into t1 set i = null;
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
insert into t1 set i = 254;
|
||||
ERROR 23000: Duplicate entry '254' for key 1
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
insert into t1 set i = null;
|
||||
ERROR 23000: Duplicate entry '255' for key 1
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
0
|
||||
drop table t1;
|
||||
create table t1 (i tinyint unsigned not null auto_increment, key (i));
|
||||
insert into t1 set i = 254;
|
||||
|
@ -80,6 +80,9 @@ insert into t1 set i = 254;
|
||||
insert into t1 set i = null;
|
||||
select last_insert_id();
|
||||
--error 1062
|
||||
insert into t1 set i = 254;
|
||||
select last_insert_id();
|
||||
--error 1062
|
||||
insert into t1 set i = null;
|
||||
select last_insert_id();
|
||||
drop table t1;
|
||||
@ -100,5 +103,6 @@ select last_insert_id();
|
||||
--error 1062
|
||||
insert into t1 values (NULL, 10);
|
||||
select last_insert_id();
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
Reference in New Issue
Block a user