summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/compound.test2
-rw-r--r--mysql-test/main/ctype_utf8mb4_unicode_ci_def.opt1
-rw-r--r--mysql-test/main/ctype_utf8mb4_unicode_ci_def.result11
-rw-r--r--mysql-test/main/ctype_utf8mb4_unicode_ci_def.test15
-rw-r--r--mysql-test/main/disabled.def1
-rw-r--r--mysql-test/main/order_by_innodb.result23
-rw-r--r--mysql-test/main/order_by_innodb.test22
-rw-r--r--mysql-test/main/partition_open_files_limit.result2
-rw-r--r--mysql-test/main/ps.result13
-rw-r--r--mysql-test/main/ps.test16
-rw-r--r--mysql-test/main/table_value_constr.result42
-rw-r--r--mysql-test/main/table_value_constr.test46
12 files changed, 192 insertions, 2 deletions
diff --git a/mysql-test/main/compound.test b/mysql-test/main/compound.test
index 1f901e2a2b3..cb8bc0122c4 100644
--- a/mysql-test/main/compound.test
+++ b/mysql-test/main/compound.test
@@ -1,7 +1,7 @@
#
# MDEV-5317 Compound statement / anonymous blocks
#
-source include/have_log_bin.inc;
+source include/have_binlog_format_mixed_or_statement.inc;
delimiter |;
CREATE TABLE t1 (a INT PRIMARY KEY)|
diff --git a/mysql-test/main/ctype_utf8mb4_unicode_ci_def.opt b/mysql-test/main/ctype_utf8mb4_unicode_ci_def.opt
new file mode 100644
index 00000000000..e430a45c10e
--- /dev/null
+++ b/mysql-test/main/ctype_utf8mb4_unicode_ci_def.opt
@@ -0,0 +1 @@
+--character-set-server=utf8mb4,latin1 --collation-server=utf8mb4_unicode_ci
diff --git a/mysql-test/main/ctype_utf8mb4_unicode_ci_def.result b/mysql-test/main/ctype_utf8mb4_unicode_ci_def.result
new file mode 100644
index 00000000000..2e15931248b
--- /dev/null
+++ b/mysql-test/main/ctype_utf8mb4_unicode_ci_def.result
@@ -0,0 +1,11 @@
+#
+# Start of 10.3 tests
+#
+#
+# MDEV-27195 SIGSEGV in Table_scope_and_contents_source_st::vers_check_system_fields
+#
+CREATE TABLE t1 ENGINE=MyISAM WITH SYSTEM VERSIONING AS SELECT 0;
+DROP TABLE t1;
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/ctype_utf8mb4_unicode_ci_def.test b/mysql-test/main/ctype_utf8mb4_unicode_ci_def.test
new file mode 100644
index 00000000000..fb7fbe04e3b
--- /dev/null
+++ b/mysql-test/main/ctype_utf8mb4_unicode_ci_def.test
@@ -0,0 +1,15 @@
+--echo #
+--echo # Start of 10.3 tests
+--echo #
+
+--echo #
+--echo # MDEV-27195 SIGSEGV in Table_scope_and_contents_source_st::vers_check_system_fields
+--echo #
+
+CREATE TABLE t1 ENGINE=MyISAM WITH SYSTEM VERSIONING AS SELECT 0;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/main/disabled.def b/mysql-test/main/disabled.def
index 8ba5b271c2b..6ae67e00eca 100644
--- a/mysql-test/main/disabled.def
+++ b/mysql-test/main/disabled.def
@@ -16,4 +16,3 @@ mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 chang
#show_explain : Psergey: random timeout in range-checked-for-each record query.
file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
-partition_open_files_limit : open_files_limit check broken by MDEV-18360
diff --git a/mysql-test/main/order_by_innodb.result b/mysql-test/main/order_by_innodb.result
index 14b9b861a14..28922ef65f2 100644
--- a/mysql-test/main/order_by_innodb.result
+++ b/mysql-test/main/order_by_innodb.result
@@ -198,5 +198,28 @@ id id
1 NULL
2 1
3 3
+#
+# MDEV-27270: Wrong query plan with Range Checked for Each Record and ORDER BY ... LIMIT
+#
+# This must NOT have "Range checked for each record" without any
+# provisions to produce rows in the required ordering:
+explain
+select
+t1.id,t2.id
+from
+t1 left join
+t2 on t2.id2 = t1.id and
+t2.id = (select dd.id
+from t2 dd
+where
+dd.id2 = t1.id and
+d1 > '2019-02-06 00:00:00'
+ order by
+dd.d1, dd.d2, dd.id limit 1
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index
+1 PRIMARY t2 eq_ref PRIMARY,id2 PRIMARY 4 func # Using where
+2 DEPENDENT SUBQUERY dd range id2,for_latest_sort for_latest_sort 6 NULL # Using where
drop table t1,t2;
# End of 10.2 tests
diff --git a/mysql-test/main/order_by_innodb.test b/mysql-test/main/order_by_innodb.test
index 97c043b8dbc..af12644c073 100644
--- a/mysql-test/main/order_by_innodb.test
+++ b/mysql-test/main/order_by_innodb.test
@@ -184,6 +184,28 @@ from
order by
dd.d1 desc, dd.d2 desc, dd.id desc limit 1
);
+
+--echo #
+--echo # MDEV-27270: Wrong query plan with Range Checked for Each Record and ORDER BY ... LIMIT
+--echo #
+
+--echo # This must NOT have "Range checked for each record" without any
+--echo # provisions to produce rows in the required ordering:
+--replace_column 9 #
+explain
+select
+ t1.id,t2.id
+from
+ t1 left join
+ t2 on t2.id2 = t1.id and
+ t2.id = (select dd.id
+ from t2 dd
+ where
+ dd.id2 = t1.id and
+ d1 > '2019-02-06 00:00:00'
+ order by
+ dd.d1, dd.d2, dd.id limit 1
+ );
drop table t1,t2;
--echo # End of 10.2 tests
diff --git a/mysql-test/main/partition_open_files_limit.result b/mysql-test/main/partition_open_files_limit.result
index fed32a69c44..327fe24d27d 100644
--- a/mysql-test/main/partition_open_files_limit.result
+++ b/mysql-test/main/partition_open_files_limit.result
@@ -1,4 +1,6 @@
DROP TABLE IF EXISTS `t1`;
+call mtr.add_suppression("option 'table_open_cache'");
+call mtr.add_suppression("option 'max_connections'");
# Bug#46922: crash when adding partitions and open_files_limit is reached
CREATE TABLE t1 (a INT PRIMARY KEY)
ENGINE=MyISAM PARTITION BY KEY () PARTITIONS 1;
diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result
index 7ca8499ba76..6df83228875 100644
--- a/mysql-test/main/ps.result
+++ b/mysql-test/main/ps.result
@@ -5573,6 +5573,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2, t3;
+#
+# MDEV-21866: Assertion `!result' failed in convert_const_to_int upon 2nd execution of PS
+#
+CREATE TABLE t1 (a BIGINT DEFAULT -1);
+CREATE VIEW v1 AS SELECT DISTINCT a FROM t1;
+PREPARE stmt FROM 'SELECT * FROM v1 WHERE a <=> NULL';
+EXECUTE stmt;
+a
+EXECUTE stmt;
+a
+DEALLOCATE PREPARE stmt;
+DROP VIEW v1;
+DROP TABLE t1;
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test
index a65c54c8788..9b781f32631 100644
--- a/mysql-test/main/ps.test
+++ b/mysql-test/main/ps.test
@@ -4990,6 +4990,22 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2, t3;
+--echo #
+--echo # MDEV-21866: Assertion `!result' failed in convert_const_to_int upon 2nd execution of PS
+--echo #
+
+CREATE TABLE t1 (a BIGINT DEFAULT -1);
+CREATE VIEW v1 AS SELECT DISTINCT a FROM t1;
+PREPARE stmt FROM 'SELECT * FROM v1 WHERE a <=> NULL';
+EXECUTE stmt;
+EXECUTE stmt;
+
+# Cleanup
+DEALLOCATE PREPARE stmt;
+DROP VIEW v1;
+DROP TABLE t1;
+
+
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/table_value_constr.result b/mysql-test/main/table_value_constr.result
index 7cbec119a81..9ce4a814dec 100644
--- a/mysql-test/main/table_value_constr.result
+++ b/mysql-test/main/table_value_constr.result
@@ -3100,6 +3100,48 @@ select * from (values (3),(7),(1) union values (2),(4) order by 1 limit 2) as dt
1
2
drop table t1;
+#
+# MDEV-23182: Server crashes in
+# Item::fix_fields_if_needed / table_value_constr::prepare upon 2nd execution of PS
+#
+SET @save_in_predicate_conversion_threshold=@@in_predicate_conversion_threshold;
+SET in_predicate_conversion_threshold=2;
+CREATE TABLE t1 (c VARCHAR(10)) DEFAULT CHARSET=utf8;
+PREPARE stmt FROM "SELECT * FROM t1 WHERE c IN ('10','20')";
+EXECUTE stmt;
+c
+# Without the patch second execution of the prepared statement 'stmt'
+# results in crash.
+EXECUTE stmt;
+c
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+# Check that the query without conversion doesn't crash server
+CREATE TABLE t1 (c VARCHAR(10));
+PREPARE stmt FROM "SELECT * FROM t1 WHERE c IN ('10','20')";
+EXECUTE stmt;
+c
+EXECUTE stmt;
+c
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+# Test case for a row expression in the left part of the IN clause
+CREATE TABLE t1 (a VARCHAR(3), b VARCHAR(3)) DEFAULT CHARSET=utf8;
+PREPARE stmt FROM "SELECT * FROM t1 WHERE (a, b) IN (('10', '10'), ('20', '20'))";
+EXECUTE stmt;
+a b
+EXECUTE stmt;
+a b
+DROP TABLE t1;
+# Check that the query without conversion is handled successfully
+CREATE TABLE t1 (a VARCHAR(3), b VARCHAR(3));
+PREPARE stmt FROM "SELECT * FROM t1 WHERE (a, b) IN (('10', '10'), ('20', '20'))";
+EXECUTE stmt;
+a b
+EXECUTE stmt;
+a b
+DROP TABLE t1;
+SET @@in_predicate_conversion_threshold = @save_in_predicate_conversion_threshold;
End of 10.3 tests
#
# MDEV-22610 Crash in INSERT INTO t1 (VALUES (DEFAULT) UNION VALUES (DEFAULT))
diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test
index d131022e2e0..367ce9a4366 100644
--- a/mysql-test/main/table_value_constr.test
+++ b/mysql-test/main/table_value_constr.test
@@ -1650,6 +1650,52 @@ select * from (values (3),(7),(1) union values (2),(4) order by 1 limit 2) as dt
drop table t1;
+--echo #
+--echo # MDEV-23182: Server crashes in
+--echo # Item::fix_fields_if_needed / table_value_constr::prepare upon 2nd execution of PS
+--echo #
+SET @save_in_predicate_conversion_threshold=@@in_predicate_conversion_threshold;
+SET in_predicate_conversion_threshold=2;
+
+CREATE TABLE t1 (c VARCHAR(10)) DEFAULT CHARSET=utf8;
+PREPARE stmt FROM "SELECT * FROM t1 WHERE c IN ('10','20')";
+EXECUTE stmt;
+--echo # Without the patch second execution of the prepared statement 'stmt'
+--echo # results in crash.
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+DROP TABLE t1;
+
+--echo # Check that the query without conversion doesn't crash server
+CREATE TABLE t1 (c VARCHAR(10));
+PREPARE stmt FROM "SELECT * FROM t1 WHERE c IN ('10','20')";
+EXECUTE stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+DROP TABLE t1;
+
+--echo # Test case for a row expression in the left part of the IN clause
+CREATE TABLE t1 (a VARCHAR(3), b VARCHAR(3)) DEFAULT CHARSET=utf8;
+PREPARE stmt FROM "SELECT * FROM t1 WHERE (a, b) IN (('10', '10'), ('20', '20'))";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DROP TABLE t1;
+
+--echo # Check that the query without conversion is handled successfully
+CREATE TABLE t1 (a VARCHAR(3), b VARCHAR(3));
+PREPARE stmt FROM "SELECT * FROM t1 WHERE (a, b) IN (('10', '10'), ('20', '20'))";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DROP TABLE t1;
+
+SET @@in_predicate_conversion_threshold = @save_in_predicate_conversion_threshold;
+
--echo End of 10.3 tests
--echo #