diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-12-15 19:02:50 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-12-15 19:02:50 +0530 |
commit | d9fdb5d7c0d86845b46c2af5949aab0934cde503 (patch) | |
tree | 509c1588ec398eae1477aad92be354c7b1912229 | |
parent | e5d88e03beec38973539f5d290fa70f81be645ef (diff) | |
download | mariadb-git-bb-10.3-varun.tar.gz |
MDEV-22716: Assertion `0' failed in Type_handler_row::subquery_type_allows_materializationbb-10.3-varun
For ROW data type, materialization is not possible, so IN predicate to IN subquery conversion
should not be allowed in this case.
-rw-r--r-- | mysql-test/main/subselect4.result | 15 | ||||
-rw-r--r-- | mysql-test/main/subselect4.test | 14 | ||||
-rw-r--r-- | sql/sql_type.h | 1 |
3 files changed, 29 insertions, 1 deletions
diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result index 23b6e268d91..8b4f27952c6 100644 --- a/mysql-test/main/subselect4.result +++ b/mysql-test/main/subselect4.result @@ -2751,4 +2751,19 @@ id select_type table type possible_keys key key_len ref rows Extra set names default; set @@in_predicate_conversion_threshold= @save_in_predicate_conversion_threshold; DROP TABLE t1,t2; +# +# MDEV-22716: Assertion `0' failed in Type_handler_row::subquery_type_allows_materialization +# +CREATE TABLE t1(a INT,b INT); +INSERT INTO t1 VALUES (1,1), (2,2); +set @save_in_predicate_conversion_threshold= @@in_predicate_conversion_threshold; +SET SESSION in_predicate_conversion_threshold=2; +EXPLAIN SELECT 1 FROM t1 WHERE ROW(a,(a,a)) IN ((1,(1,1)),(2,(2,1))); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +SELECT 1 FROM t1 WHERE ROW(a,(a,a)) IN ((1,(1,1)),(2,(2,1))); +1 +1 +set @@in_predicate_conversion_threshold= @save_in_predicate_conversion_threshold; +DROP TABLE t1; # End of 10.3 tests diff --git a/mysql-test/main/subselect4.test b/mysql-test/main/subselect4.test index f264b3857ff..8e2d5309991 100644 --- a/mysql-test/main/subselect4.test +++ b/mysql-test/main/subselect4.test @@ -2274,4 +2274,18 @@ set names default; set @@in_predicate_conversion_threshold= @save_in_predicate_conversion_threshold; DROP TABLE t1,t2; +--echo # +--echo # MDEV-22716: Assertion `0' failed in Type_handler_row::subquery_type_allows_materialization +--echo # + +CREATE TABLE t1(a INT,b INT); +INSERT INTO t1 VALUES (1,1), (2,2); + +set @save_in_predicate_conversion_threshold= @@in_predicate_conversion_threshold; +SET SESSION in_predicate_conversion_threshold=2; +EXPLAIN SELECT 1 FROM t1 WHERE ROW(a,(a,a)) IN ((1,(1,1)),(2,(2,1))); +SELECT 1 FROM t1 WHERE ROW(a,(a,a)) IN ((1,(1,1)),(2,(2,1))); +set @@in_predicate_conversion_threshold= @save_in_predicate_conversion_threshold; + +DROP TABLE t1; --echo # End of 10.3 tests diff --git a/sql/sql_type.h b/sql/sql_type.h index 4a7a7b5a9b8..325be2d53bc 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -1485,7 +1485,6 @@ public: const Item *outer, bool is_in_predicate) const { - DBUG_ASSERT(0); return false; } Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const |