diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/maria.result | 42 | ||||
-rw-r--r-- | mysql-test/t/maria.test | 27 |
2 files changed, 69 insertions, 0 deletions
diff --git a/mysql-test/r/maria.result b/mysql-test/r/maria.result index bf412e0af2d..13ad2b4617e 100644 --- a/mysql-test/r/maria.result +++ b/mysql-test/r/maria.result @@ -2200,3 +2200,45 @@ id f1 2 test2 drop table t1; SET SQL_MODE = 'TRADITIONAL'; +create table t1 (n int not null primary key auto_increment, c char(1), unique(c)); +insert into t1 values(100, "a"); +insert into t1 values(300, "b"); +insert into t1 values(50, "a"); +ERROR 23000: Duplicate entry 'a' for key 'c' +insert into t1 values(null, "c"); +select * from t1; +n c +100 a +300 b +301 c +update t1 set n=400,c='a' where n=301; +ERROR 23000: Duplicate entry 'a' for key 'c' +insert into t1 values(null, "d"); +select * from t1; +n c +100 a +300 b +301 c +302 d +drop table t1; +create table t1 (n int not null primary key auto_increment, c char(1), unique(c)) transactional=0 row_format=dynamic; +insert into t1 values(100, "a"); +insert into t1 values(300, "b"); +insert into t1 values(50, "a"); +ERROR 23000: Duplicate entry 'a' for key 'c' +insert into t1 values(null, "c"); +select * from t1; +n c +100 a +300 b +301 c +update t1 set n=400,c='a' where n=301; +ERROR 23000: Duplicate entry 'a' for key 'c' +insert into t1 values(null, "d"); +select * from t1; +n c +100 a +300 b +301 c +302 d +drop table t1; diff --git a/mysql-test/t/maria.test b/mysql-test/t/maria.test index d4e9a20e7b9..3c47e363ddc 100644 --- a/mysql-test/t/maria.test +++ b/mysql-test/t/maria.test @@ -1426,6 +1426,33 @@ SELECT * FROM t1; drop table t1; SET SQL_MODE = 'TRADITIONAL'; +create table t1 (n int not null primary key auto_increment, c char(1), unique(c)); +insert into t1 values(100, "a"); +insert into t1 values(300, "b"); +--error 1062 +insert into t1 values(50, "a"); +insert into t1 values(null, "c"); +select * from t1; +--error 1062 +update t1 set n=400,c='a' where n=301; +insert into t1 values(null, "d"); +select * from t1; +drop table t1; + +create table t1 (n int not null primary key auto_increment, c char(1), unique(c)) transactional=0 row_format=dynamic; +insert into t1 values(100, "a"); +insert into t1 values(300, "b"); +--error 1062 +insert into t1 values(50, "a"); +insert into t1 values(null, "c"); +select * from t1; +--error 1062 +update t1 set n=400,c='a' where n=301; +insert into t1 values(null, "d"); +select * from t1; +drop table t1; + + # End of 5.2 tests --disable_result_log |