Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
Add another testcase: suite/rocksdb/update_ignore.test
Browse files Browse the repository at this point in the history
  • Loading branch information
spetrunia authored and Jonah Cohen committed Dec 19, 2014
1 parent e45b0a2 commit 1ed1f2d
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
57 changes: 57 additions & 0 deletions mysql-test/suite/rocksdb/update_ignore.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
INSERT INTO t1 (a,b) SELECT a, b FROM t1;
CREATE TABLE t2 (c CHAR(8), d INT, pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb;
INSERT INTO t2 (c,d) SELECT b, a FROM t1;
UPDATE IGNORE t1 SET b = 'upd1' WHERE b IS NOT NULL ORDER BY a LIMIT 1;
SELECT a,b FROM t1 ORDER BY pk;
a b
1 upd1
2 b
3 c
4 d
5 e
10000 foobar
1 a
2 b
3 c
4 d
5 e
10000 foobar
UPDATE t1, t2 SET b = 'upd2a', c = 'upd2b'
WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 );
ERROR 21000: Subquery returns more than 1 row
UPDATE IGNORE t1, t2 SET b = 'upd2a', c = 'upd2b'
WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 );
Warnings:
Error 1242 Subquery returns more than 1 row
SELECT a,b FROM t1 ORDER BY pk;
a b
1 upd2a
2 upd2a
3 upd2a
4 upd2a
5 upd2a
10000 upd2a
1 a
2 upd2a
3 upd2a
4 upd2a
5 upd2a
10000 upd2a
SELECT c,d FROM t2 ORDER BY pk;
c d
upd2b 1
upd2b 2
upd2b 3
upd2b 4
upd2b 5
upd2b 10000
upd2b 1
upd2b 2
upd2b 3
upd2b 4
upd2b 5
upd2b 10000
DROP TABLE t1, t2;
33 changes: 33 additions & 0 deletions mysql-test/suite/rocksdb/update_ignore.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# UPDATE IGNORE
#

--disable_warnings
DROP TABLE IF EXISTS t1,t2;
--enable_warnings

CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb;

INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
INSERT INTO t1 (a,b) SELECT a, b FROM t1;

CREATE TABLE t2 (c CHAR(8), d INT, pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb;

INSERT INTO t2 (c,d) SELECT b, a FROM t1;

UPDATE IGNORE t1 SET b = 'upd1' WHERE b IS NOT NULL ORDER BY a LIMIT 1;
SELECT a,b FROM t1 ORDER BY pk;

--error ER_SUBQUERY_NO_1_ROW
UPDATE t1, t2 SET b = 'upd2a', c = 'upd2b'
WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 );

UPDATE IGNORE t1, t2 SET b = 'upd2a', c = 'upd2b'
WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 );

SELECT a,b FROM t1 ORDER BY pk;
SELECT c,d FROM t2 ORDER BY pk;

# Cleanup
DROP TABLE t1, t2;

0 comments on commit 1ed1f2d

Please sign in to comment.