Commit d9fdb5d7 authored by Varun Gupta's avatar Varun Gupta

MDEV-22716: Assertion `0' failed in Type_handler_row::subquery_type_allows_materialization

For ROW data type, materialization is not possible, so IN predicate to IN subquery conversion
should not be allowed in this case.
parent e5d88e03
......@@ -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
......@@ -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
......@@ -1485,7 +1485,6 @@ class Type_handler_row: public Type_handler
const Item *outer,
bool is_in_predicate) const
{
DBUG_ASSERT(0);
return false;
}
Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment