From 83516a33a8397ba537b6e85f0a386ade73f2e8f7 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 14 Apr 2022 12:22:28 +0400 Subject: An additional patch for MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition Applying the fix to sql_yacc_ora.yy. Adding a test for sql_mode=ORACLE. --- mysql-test/suite/compat/oracle/r/misc.result | 23 +++++++++++++++++++++++ mysql-test/suite/compat/oracle/t/misc.test | 28 ++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) (limited to 'mysql-test/suite/compat') diff --git a/mysql-test/suite/compat/oracle/r/misc.result b/mysql-test/suite/compat/oracle/r/misc.result index 38f38bd07e6..fed7e26c31b 100644 --- a/mysql-test/suite/compat/oracle/r/misc.result +++ b/mysql-test/suite/compat/oracle/r/misc.result @@ -1,5 +1,25 @@ SET sql_mode=ORACLE; # +# Start of 10.2 tests +# +# +# MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition +# +CREATE TABLE t1 (a CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT); +DROP TABLE t1; +SELECT CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT); +CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT) +a +SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET latin1 COLLATE DEFAULT) AS c1; +c1 +string +# +# End of 10.2 tests +# +# +# Start of 10.3 tests +# +# # MDEV-12086 sql_mode=ORACLE: allow SELECT UNIQUE as a synonym for SELECT DISTINCT # CREATE TABLE t1 (a INT); @@ -10,3 +30,6 @@ a 20 30 DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/compat/oracle/t/misc.test b/mysql-test/suite/compat/oracle/t/misc.test index d939b20f8a0..b3fdfdf3851 100644 --- a/mysql-test/suite/compat/oracle/t/misc.test +++ b/mysql-test/suite/compat/oracle/t/misc.test @@ -1,5 +1,28 @@ SET sql_mode=ORACLE; +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition +--echo # + +CREATE TABLE t1 (a CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT); +DROP TABLE t1; +SELECT CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT); +SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET latin1 COLLATE DEFAULT) AS c1; + +--echo # +--echo # End of 10.2 tests +--echo # + + + +--echo # +--echo # Start of 10.3 tests +--echo # + --echo # --echo # MDEV-12086 sql_mode=ORACLE: allow SELECT UNIQUE as a synonym for SELECT DISTINCT --echo # @@ -8,3 +31,8 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (10),(20),(20),(30),(30),(30); SELECT UNIQUE a FROM t1; DROP TABLE t1; + + +--echo # +--echo # End of 10.3 tests +--echo # -- cgit v1.2.1 From 7498978e6af867c3351f8a1392a0de66d2dfae24 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Wed, 13 Apr 2022 19:56:34 +0700 Subject: MDEV-27699 ANALYZE FORMAT=JSON fields are incorrect for UNION ALL queries UNION ALL queries are a subject of optimization introduced in MDEV-334 when creation of a temporary table is skipped. While there is a check for this optimization in Explain_union::print_explain() there was no such in Explain_union::print_explain_json(). This resulted in printing irrelevant data like: "union_result": { "table_name": "", "access_type": "ALL", "r_loops": 0, "r_rows": null in case when creation of the temporary table was actually optimized out. This commits adds a check whether the temporary table was actually created during the UNION ALL processing and eliminates printing of the irrelevant data. --- .../compat/oracle/r/table_value_constr.result | 24 ---------------------- 1 file changed, 24 deletions(-) (limited to 'mysql-test/suite/compat') diff --git a/mysql-test/suite/compat/oracle/r/table_value_constr.result b/mysql-test/suite/compat/oracle/r/table_value_constr.result index 539329554d5..daea0eccb19 100644 --- a/mysql-test/suite/compat/oracle/r/table_value_constr.result +++ b/mysql-test/suite/compat/oracle/r/table_value_constr.result @@ -1302,8 +1302,6 @@ EXPLAIN { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -1523,8 +1521,6 @@ EXPLAIN { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -1587,8 +1583,6 @@ EXPLAIN { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -1631,8 +1625,6 @@ EXPLAIN { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -1675,10 +1667,6 @@ ANALYZE { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", - "r_loops": 0, - "r_rows": null, "query_specifications": [ { "query_block": { @@ -1906,10 +1894,6 @@ ANALYZE { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", - "r_loops": 0, - "r_rows": null, "query_specifications": [ { "query_block": { @@ -1974,10 +1958,6 @@ ANALYZE { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", - "r_loops": 0, - "r_rows": null, "query_specifications": [ { "query_block": { @@ -2020,10 +2000,6 @@ ANALYZE { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", - "r_loops": 0, - "r_rows": null, "query_specifications": [ { "query_block": { -- cgit v1.2.1