diff options
author | unknown <serg@sergbook.mysql.com> | 2003-03-31 23:14:26 +0400 |
---|---|---|
committer | unknown <serg@sergbook.mysql.com> | 2003-03-31 23:14:26 +0400 |
commit | 76bd91752616f251cd7177971e30ec2e8939d356 (patch) | |
tree | 11a64e2559175719b5ebced7d91d2316bcc2060a /mysql-test/t/auto_increment.test | |
parent | 7e13ac1242b8e9f229b76687622bc1f5de301b92 (diff) | |
download | mariadb-git-76bd91752616f251cd7177971e30ec2e8939d356.tar.gz |
don't increment LAST_INSERT_ID() when incremented value cannot be stored in auto_increment column (e.g. is too big)
mysql-test/r/auto_increment.result:
more tests
mysql-test/t/auto_increment.test:
more tests
Diffstat (limited to 'mysql-test/t/auto_increment.test')
-rw-r--r-- | mysql-test/t/auto_increment.test | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index d7f67fe80d4..63fdfded6d0 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -72,3 +72,33 @@ select * from t1; check table t1; drop table t1; +# +# last_insert_id() madness +# +create table t1 (i tinyint unsigned not null auto_increment primary key); +insert into t1 set i = 254; +insert into t1 set i = null; +select last_insert_id(); +--error 1062 +insert into t1 set i = null; +select last_insert_id(); +drop table t1; + +create table t1 (i tinyint unsigned not null auto_increment, key (i)); +insert into t1 set i = 254; +insert into t1 set i = null; +select last_insert_id(); +insert into t1 set i = null; +select last_insert_id(); +drop table t1; + +create table t1 (i tinyint unsigned not null auto_increment primary key, b int, unique (b)); +insert into t1 values (NULL, 10); +select last_insert_id(); +insert into t1 values (NULL, 15); +select last_insert_id(); +--error 1062 +insert into t1 values (NULL, 10); +select last_insert_id(); +drop table t1; + |