diff options
author | unknown <magnus@neptunus.(none)> | 2004-09-20 11:14:31 +0200 |
---|---|---|
committer | unknown <magnus@neptunus.(none)> | 2004-09-20 11:14:31 +0200 |
commit | c06c007818d9456d65e8b05c14d966ce9d7a9a4d (patch) | |
tree | 59ea66791f538e967ab76f7581720025507db61b /mysql-test | |
parent | 8b79d2b502455f604c80180e342920b16ed149fd (diff) | |
parent | 38238355c2acb7c64a653db2756856475dc04026 (diff) | |
download | mariadb-git-c06c007818d9456d65e8b05c14d966ce9d7a9a4d.tar.gz |
Merged new ndb_insert.test and .result
sql/ha_ndbcluster.cc:
Auto merged
sql/ha_ndbcluster.h:
Auto merged
mysql-test/r/ndb_insert.result:
Merge new test cases
mysql-test/t/ndb_insert.test:
Merge new test cases
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/ndb_insert.result | 119 | ||||
-rw-r--r-- | mysql-test/t/ndb_insert.test | 119 |
2 files changed, 230 insertions, 8 deletions
diff --git a/mysql-test/r/ndb_insert.result b/mysql-test/r/ndb_insert.result index 2944230deef..3ee6780cc46 100644 --- a/mysql-test/r/ndb_insert.result +++ b/mysql-test/r/ndb_insert.result @@ -420,6 +420,9 @@ INSERT INTO t1 VALUES (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10); ERROR 23000: Duplicate entry '10' for key 1 +select count(*) from t1; +count(*) +2000 begin; SELECT COUNT(*) FROM t1; COUNT(*) @@ -437,9 +440,121 @@ SELECT COUNT(*) FROM t1; COUNT(*) 2000 commit; -SELECT COUNT(*) FROM t1; -COUNT(*) +ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster +select * from t1 where pk1=1; +pk1 b c +1 1 1 +select * from t1 where pk1=10; +pk1 b c +10 10 10 +select count(*) from t1 where pk1 <= 10 order by pk1; +count(*) +11 +select count(*) from t1; +count(*) +2000 +begin; +INSERT INTO t1 VALUES +(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), +(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10); +ERROR 23000: Duplicate entry '10' for key 1 +rollback; +select * from t1 where pk1=1; +pk1 b c +1 1 1 +select * from t1 where pk1=10; +pk1 b c +10 10 10 +select count(*) from t1 where pk1 <= 10 order by pk1; +count(*) +11 +select count(*) from t1; +count(*) +2000 +begin; +INSERT INTO t1 VALUES +(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), +(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10); +ERROR 23000: Duplicate entry '10' for key 1 +SELECT * FROM t1 WHERE pk1=10; +ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster +rollback; +select * from t1 where pk1=1; +pk1 b c +1 1 1 +select * from t1 where pk1=10; +pk1 b c +10 10 10 +select count(*) from t1 where pk1 <= 10 order by pk1; +count(*) +11 +select count(*) from t1; +count(*) +2000 +begin; +INSERT INTO t1 VALUES +(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), +(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10); +ERROR 23000: Duplicate entry '10' for key 1 +SELECT * FROM t1 WHERE pk1=10; +ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster +SELECT * FROM t1 WHERE pk1=10; +ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster +commit; +ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster +select * from t1 where pk1=1; +pk1 b c +1 1 1 +select * from t1 where pk1=10; +pk1 b c +10 10 10 +select count(*) from t1 where pk1 <= 10 order by pk1; +count(*) +11 +select count(*) from t1; +count(*) +2000 +begin; +INSERT INTO t1 VALUES +(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), +(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10); +ERROR 23000: Duplicate entry '10' for key 1 +INSERT INTO t1 values (4000, 40, 44); +ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster +rollback; +select * from t1 where pk1=1; +pk1 b c +1 1 1 +select * from t1 where pk1=10; +pk1 b c +10 10 10 +select count(*) from t1 where pk1 <= 10 order by pk1; +count(*) +11 +select count(*) from t1; +count(*) 2000 insert into t1 select * from t1 where b < 10 order by pk1; ERROR 23000: Duplicate entry '9' for key 1 +begin; +INSERT IGNORE INTO t1 VALUES(1,2,3); +ERROR HY000: Table storage engine for 't1' doesn't have this option +commit; +select * from t1 where pk1=1; +pk1 b c +1 1 1 +INSERT IGNORE INTO t1 VALUES(1,2,3); +ERROR HY000: Table storage engine for 't1' doesn't have this option +select * from t1 where pk1=1; +pk1 b c +1 1 1 +REPLACE INTO t1 values(1, 2, 3); +select * from t1 where pk1=1; +pk1 b c +1 2 3 +INSERT INTO t1 VALUES(1,1,1) ON DUPLICATE KEY UPDATE b=79; +ERROR HY000: Table storage engine for 't1' doesn't have this option +select * from t1 where pk1=1; +pk1 b c +1 2 3 DROP TABLE t1; diff --git a/mysql-test/t/ndb_insert.test b/mysql-test/t/ndb_insert.test index 1a8103924a4..7ea25554ce3 100644 --- a/mysql-test/t/ndb_insert.test +++ b/mysql-test/t/ndb_insert.test @@ -437,27 +437,117 @@ INSERT INTO t1 VALUES (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10); +select count(*) from t1; +# +# Insert duplicate rows, inside transaction +# try to commit +# begin; +--error 1062 +INSERT INTO t1 VALUES +(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), +(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10); + +--error 1296 +commit; + +select * from t1 where pk1=1; +select * from t1 where pk1=10; +select count(*) from t1 where pk1 <= 10 order by pk1; +select count(*) from t1; + + # # Insert duplicate rows, inside transaction -# since failing inserts rollbacks whole transaction -# all select count (except second) return same value +# rollback # -SELECT COUNT(*) FROM t1; +begin; + +--error 1062 INSERT INTO t1 VALUES -(2001,2001,2001),(2002,2002,2002),(2003,2003,2003),(2004,2004,2004),(2005,2005,2005); -SELECT COUNT(*) FROM t1; +(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), +(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10); + +rollback; + +select * from t1 where pk1=1; +select * from t1 where pk1=10; +select count(*) from t1 where pk1 <= 10 order by pk1; +select count(*) from t1; + + +# +# Insert duplicate rows, inside transaction +# then try to select, finally rollback +# +begin; + --error 1062 INSERT INTO t1 VALUES (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10); -SELECT COUNT(*) FROM t1; +--error 1296 +SELECT * FROM t1 WHERE pk1=10; + +rollback; + +select * from t1 where pk1=1; +select * from t1 where pk1=10; +select count(*) from t1 where pk1 <= 10 order by pk1; +select count(*) from t1; + + +# +# Insert duplicate rows, inside transaction +# then try to select, finally commit +# +begin; + +--error 1062 +INSERT INTO t1 VALUES +(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), +(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10); + +--error 1296 +SELECT * FROM t1 WHERE pk1=10; + +--error 1296 +SELECT * FROM t1 WHERE pk1=10; + +--error 1296 commit; SELECT COUNT(*) FROM t1; +select * from t1 where pk1=1; +select * from t1 where pk1=10; +select count(*) from t1 where pk1 <= 10 order by pk1; +select count(*) from t1; + + +# +# Insert duplicate rows, inside transaction +# then try to do another insert +# +begin; + +--error 1062 +INSERT INTO t1 VALUES +(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), +(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10); + +--error 1296 +INSERT INTO t1 values (4000, 40, 44); + +rollback; + +select * from t1 where pk1=1; +select * from t1 where pk1=10; +select count(*) from t1 where pk1 <= 10 order by pk1; +select count(*) from t1; + # # Insert duplicate rows using "insert .. select" @@ -466,4 +556,21 @@ SELECT COUNT(*) FROM t1; insert into t1 select * from t1 where b < 10 order by pk1; +begin; +--error 1031 +INSERT IGNORE INTO t1 VALUES(1,2,3); +commit; +select * from t1 where pk1=1; + +--error 1031 +INSERT IGNORE INTO t1 VALUES(1,2,3); +select * from t1 where pk1=1; + +REPLACE INTO t1 values(1, 2, 3); +select * from t1 where pk1=1; + +--error 1031 +INSERT INTO t1 VALUES(1,1,1) ON DUPLICATE KEY UPDATE b=79; +select * from t1 where pk1=1; + DROP TABLE t1; |