diff options
Diffstat (limited to 'mysql-test/include')
-rw-r--r-- | mysql-test/include/ctype_nopad_prefix_unique.inc | 85 | ||||
-rw-r--r-- | mysql-test/include/expect_crash.inc | 4 | ||||
-rw-r--r-- | mysql-test/include/explain_non_select.inc | 16 | ||||
-rw-r--r-- | mysql-test/include/kill_galera.inc | 4 | ||||
-rw-r--r-- | mysql-test/include/kill_mysqld.inc | 4 | ||||
-rw-r--r-- | mysql-test/include/shutdown_mysqld.inc | 4 |
6 files changed, 109 insertions, 8 deletions
diff --git a/mysql-test/include/ctype_nopad_prefix_unique.inc b/mysql-test/include/ctype_nopad_prefix_unique.inc new file mode 100644 index 00000000000..b25128e9fef --- /dev/null +++ b/mysql-test/include/ctype_nopad_prefix_unique.inc @@ -0,0 +1,85 @@ +--echo # +--echo # MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations +--echo # + +# TEXT + +if (`SELECT UPPER(@@storage_engine) != 'MEMORY'`) +{ +EXECUTE IMMEDIATE REPLACE( + 'CREATE TABLE t1 ( ' + ' a TEXT COLLATE <COLLATION>,' + 'UNIQUE(a(3)))', + '<COLLATION>', @@collation_connection); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('ss '); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; + + +EXECUTE IMMEDIATE REPLACE( + 'CREATE TABLE t1 ( ' + ' a TEXT COLLATE <COLLATION>,' + 'UNIQUE(a(3)) USING HASH)', + '<COLLATION>', @@collation_connection); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('ss '); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; +} + + +# VARCHAR + +EXECUTE IMMEDIATE REPLACE( + 'CREATE TABLE t1 ( ' + ' a VARCHAR(2000) COLLATE <COLLATION>,' + 'UNIQUE(a(3)))', + '<COLLATION>', @@collation_connection); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('ss '); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; + + +EXECUTE IMMEDIATE REPLACE( + 'CREATE TABLE t1 ( ' + ' a VARCHAR(2000) COLLATE <COLLATION>,' + 'UNIQUE(a(3)) USING HASH)', + '<COLLATION>', @@collation_connection); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('ss '); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; + +# CHAR + +# MyISAM is buggy on CHAR+BTREE+UNIQUE+PREFIX (see MDEV-30048), disable for now +# Other engines work fine + +if (`SELECT UPPER(@@storage_engine) != 'MYISAM'`) +{ +EXECUTE IMMEDIATE REPLACE( + 'CREATE TABLE t1 ( ' + ' a CHAR(20) COLLATE <COLLATION>,' + 'UNIQUE(a(3)))', + '<COLLATION>', @@collation_connection); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; +} + +EXECUTE IMMEDIATE REPLACE( + 'CREATE TABLE t1 ( ' + ' a CHAR(20) COLLATE <COLLATION>,' + 'UNIQUE(a(3)) USING HASH)', + '<COLLATION>', @@collation_connection); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; diff --git a/mysql-test/include/expect_crash.inc b/mysql-test/include/expect_crash.inc index af8b0908104..b4bd9828a08 100644 --- a/mysql-test/include/expect_crash.inc +++ b/mysql-test/include/expect_crash.inc @@ -1,5 +1,5 @@ ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect # There should be a debug crash after using this .inc file --exec echo "wait" > $_expect_file_name diff --git a/mysql-test/include/explain_non_select.inc b/mysql-test/include/explain_non_select.inc index d22310c9813..bd0962d3876 100644 --- a/mysql-test/include/explain_non_select.inc +++ b/mysql-test/include/explain_non_select.inc @@ -788,6 +788,22 @@ INSERT INTO t1 VALUES (1), (2), (3), (4), (5); DROP TABLE t1; +--echo #75 + +CREATE TABLE t1 (id INT PRIMARY KEY, i INT); +--let $query = INSERT INTO t1 VALUES (3,10), (7,11), (3,11) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id); +--source include/explain_utils.inc +DROP TABLE t1; + +--echo #76 + +CREATE TABLE t1 (id INT PRIMARY KEY, i INT); +CREATE TABLE t2 (a INT, b INT); +INSERT INTO t2 VALUES (1,10), (3,10), (7,11), (3,11); +--let $query = INSERT INTO t1 SELECT * FROM t2 ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id); +--source include/explain_utils.inc +DROP TABLE t1,t2; + --echo # --echo # Bug #12949629: CLIENT LOSES CONNECTION AFTER EXECUTING A PROCEDURE WITH --echo # EXPLAIN UPDATE/DEL/INS diff --git a/mysql-test/include/kill_galera.inc b/mysql-test/include/kill_galera.inc index d7f665df6c7..aba672d8a89 100644 --- a/mysql-test/include/kill_galera.inc +++ b/mysql-test/include/kill_galera.inc @@ -1,8 +1,8 @@ --echo Killing server ... # Write file to make mysql-test-run.pl expect the crash, but don't start it ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo "wait" > $_expect_file_name # Kill the connected server diff --git a/mysql-test/include/kill_mysqld.inc b/mysql-test/include/kill_mysqld.inc index 86ee048a0f1..01ee7f82bdc 100644 --- a/mysql-test/include/kill_mysqld.inc +++ b/mysql-test/include/kill_mysqld.inc @@ -1,5 +1,5 @@ ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --echo # Kill the server --exec echo "wait" > $_expect_file_name diff --git a/mysql-test/include/shutdown_mysqld.inc b/mysql-test/include/shutdown_mysqld.inc index db0cfb82c68..fc2972560c3 100644 --- a/mysql-test/include/shutdown_mysqld.inc +++ b/mysql-test/include/shutdown_mysqld.inc @@ -22,8 +22,8 @@ if ($rpl_inited) } # Write file to make mysql-test-run.pl expect the "crash", but don't start it ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo "wait" > $_expect_file_name # Avoid warnings from connection threads that does not have time to exit |