diff options
author | Sergei Petrunia <sergey@mariadb.com> | 2022-12-28 21:26:45 +0300 |
---|---|---|
committer | Sergei Petrunia <sergey@mariadb.com> | 2022-12-28 21:26:45 +0300 |
commit | eea4a1a90e2ab55ae327f92016e3562131c5c6cf (patch) | |
tree | 3990dcffe84bf43d91fb571ea14f712e2370825a | |
parent | 8742b0fe1bf9ef217b48ebd56a174a11e7b09959 (diff) | |
download | mariadb-git-bb-11.0-mdev30310-updated.tar.gz |
MDEV-30310: patch from Monty, a bit amendedbb-11.0-mdev30310-updated
-rw-r--r-- | mysql-test/main/derived.result | 19 | ||||
-rw-r--r-- | mysql-test/main/derived.test | 19 | ||||
-rw-r--r-- | mysql-test/main/func_group.result | 2 | ||||
-rw-r--r-- | mysql-test/main/metadata.result | 8 | ||||
-rw-r--r-- | mysql-test/main/mysql_client_test.result | 2 | ||||
-rw-r--r-- | mysql-test/main/type_enum.result | 2 | ||||
-rw-r--r-- | mysql-test/main/type_set.result | 2 | ||||
-rw-r--r-- | sql/sql_union.cc | 4 |
8 files changed, 46 insertions, 12 deletions
diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result index 422b2b07230..47c5cd39322 100644 --- a/mysql-test/main/derived.result +++ b/mysql-test/main/derived.result @@ -1419,5 +1419,24 @@ A 1 drop table t1, duplicates_tbl; # +# MDEV-30310 +# Assertion failure in best_access_path upon IN exceeding +# IN_PREDICATE_CONVERSION_THRESHOLD, derived_with_keys=off +# +CREATE TABLE t1 (l_orderkey int); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (o_orderkey int); +INSERT INTO t2 VALUES (3),(4); +SET IN_PREDICATE_CONVERSION_THRESHOLD= 2; +SET OPTIMIZER_SWITCH='derived_with_keys=on'; +SELECT * FROM t1 JOIN t2 ON (l_orderkey = o_orderkey) WHERE l_orderkey IN (1, 2, 3); +l_orderkey o_orderkey +SET OPTIMIZER_SWITCH='derived_with_keys=off'; +SELECT * FROM t1 JOIN t2 ON (l_orderkey = o_orderkey) WHERE l_orderkey IN (1, 2, 3); +l_orderkey o_orderkey +SET @@IN_PREDICATE_CONVERSION_THRESHOLD=@@global.IN_PREDICATE_CONVERSION_THRESHOLD; +SET @@OPTIMIZER_SWITCH=@@global.OPTIMIZER_SWITCH; +DROP TABLE t1, t2; +# # End of 11.0 tests # diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test index 3bb52e603f9..5119bca4ea8 100644 --- a/mysql-test/main/derived.test +++ b/mysql-test/main/derived.test @@ -1206,5 +1206,24 @@ from t1; drop table t1, duplicates_tbl; --echo # +--echo # MDEV-30310 +--echo # Assertion failure in best_access_path upon IN exceeding +--echo # IN_PREDICATE_CONVERSION_THRESHOLD, derived_with_keys=off +--echo # + +CREATE TABLE t1 (l_orderkey int); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (o_orderkey int); +INSERT INTO t2 VALUES (3),(4); +SET IN_PREDICATE_CONVERSION_THRESHOLD= 2; +SET OPTIMIZER_SWITCH='derived_with_keys=on'; +SELECT * FROM t1 JOIN t2 ON (l_orderkey = o_orderkey) WHERE l_orderkey IN (1, 2, 3); +SET OPTIMIZER_SWITCH='derived_with_keys=off'; +SELECT * FROM t1 JOIN t2 ON (l_orderkey = o_orderkey) WHERE l_orderkey IN (1, 2, 3); +SET @@IN_PREDICATE_CONVERSION_THRESHOLD=@@global.IN_PREDICATE_CONVERSION_THRESHOLD; +SET @@OPTIMIZER_SWITCH=@@global.OPTIMIZER_SWITCH; +DROP TABLE t1, t2; + +--echo # --echo # End of 11.0 tests --echo # diff --git a/mysql-test/main/func_group.result b/mysql-test/main/func_group.result index 1e0fd660189..82107de4657 100644 --- a/mysql-test/main/func_group.result +++ b/mysql-test/main/func_group.result @@ -1821,7 +1821,7 @@ CREATE TABLE t1(f1 YEAR(4)); INSERT INTO t1 VALUES (0000),(2001); (SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1); Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def MAX(f1) MAX(f1) 13 4 4 Y 32864 0 63 +def MAX(f1) MAX(f1) 13 4 4 Y 49248 0 63 MAX(f1) 2001 DROP TABLE t1; diff --git a/mysql-test/main/metadata.result b/mysql-test/main/metadata.result index 5786e2fd461..ab28cab52cb 100644 --- a/mysql-test/main/metadata.result +++ b/mysql-test/main/metadata.result @@ -147,7 +147,7 @@ id data data 2 female no select t1.id from t1 union select t2.id from t2; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def id id 246 4 1 Y 32768 0 63 +def id id 246 4 1 Y 49152 0 63 id 1 2 @@ -158,7 +158,7 @@ insert into t1 values (2,'two'); set @arg00=1 ; select @arg00 FROM t1 where a=1 union distinct select 1 FROM t1 where a=1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def @arg00 @arg00 8 20 1 Y 32768 0 63 +def @arg00 @arg00 8 20 1 Y 49152 0 63 @arg00 1 select * from (select @arg00) aaa; @@ -168,12 +168,12 @@ def aaa @arg00 @arg00 8 20 1 Y 32768 0 63 1 select 1 union select 1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def 1 1 3 1 1 N 32769 0 63 +def 1 1 3 1 1 N 49153 0 63 1 1 select * from (select 1 union select 1) aaa; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def aaa 1 1 3 1 1 N 32769 0 63 +def aaa 1 1 3 1 1 N 49153 0 63 1 1 drop table t1; diff --git a/mysql-test/main/mysql_client_test.result b/mysql-test/main/mysql_client_test.result index dbc1feaa23b..e32053e50f3 100644 --- a/mysql-test/main/mysql_client_test.result +++ b/mysql-test/main/mysql_client_test.result @@ -130,7 +130,7 @@ mysql_stmt_next_result(): 0; field_count: 0 # cat MYSQL_TMP_DIR/test_mdev26145.out.log # ------------------------------------ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def MAX(a) MAX(a) 3 11 0 Y 32768 0 63 +def MAX(a) MAX(a) 3 11 0 Y 49152 0 63 # ------------------------------------ diff --git a/mysql-test/main/type_enum.result b/mysql-test/main/type_enum.result index 9e313f5b302..a935e3d63cb 100644 --- a/mysql-test/main/type_enum.result +++ b/mysql-test/main/type_enum.result @@ -2377,7 +2377,7 @@ t2 CREATE TABLE `t2` ( DROP TABLE t2; SELECT c_int FROM t1 UNION SELECT c_enum FROM t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def c_int c_int 253 11 0 Y 0 0 8 +def c_int c_int 253 11 0 Y 16384 0 8 c_int SELECT COALESCE(c_int, c_enum) FROM t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr diff --git a/mysql-test/main/type_set.result b/mysql-test/main/type_set.result index 571e0d36eaf..5821bbae984 100644 --- a/mysql-test/main/type_set.result +++ b/mysql-test/main/type_set.result @@ -403,7 +403,7 @@ t2 CREATE TABLE `t2` ( DROP TABLE t2; SELECT c_int FROM t1 UNION SELECT c_set FROM t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def c_int c_int 253 33 0 Y 0 0 33 +def c_int c_int 253 33 0 Y 16384 0 33 c_int SELECT COALESCE(c_int, c_set) FROM t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 188f98aa7dd..ad3d9e6443f 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -354,8 +354,6 @@ select_unit::create_result_table(THD *thd_arg, List<Item> *column_types, return TRUE; table->keys_in_use_for_query.clear_all(); - for (uint i=0; i < table->s->fields; i++) - table->field[i]->flags &= ~(PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG); if (create_table) { @@ -393,8 +391,6 @@ select_union_recursive::create_result_table(THD *thd_arg, return true; incr_table->keys_in_use_for_query.clear_all(); - for (uint i=0; i < table->s->fields; i++) - incr_table->field[i]->flags &= ~(PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG); return false; } |