This repository has been archived by the owner on Jul 26, 2022. It is now read-only.
forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add another testcase: suite/rocksdb/update_ignore.test
- Loading branch information
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|