Commit 223483ae authored by Sergey Petrunya's avatar Sergey Petrunya

Merge

parents 4ac230e5 50ff30d8
...@@ -1964,6 +1964,28 @@ a c ...@@ -1964,6 +1964,28 @@ a c
SET optimizer_switch=@save_optimizer_switch; SET optimizer_switch=@save_optimizer_switch;
SET join_cache_level=@save_join_cache_level; SET join_cache_level=@save_join_cache_level;
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# BUG#952297: Server crashes on 2nd execution of PS in Field::is_null with semijoin+materialization
#
CREATE TABLE t1 ( a VARCHAR(1) );
INSERT INTO t1 VALUES ('y'),('z');
CREATE TABLE t2 ( b VARCHAR(1), c VARCHAR(1) );
INSERT INTO t2 VALUES ('v','v'),('v','v');
CREATE VIEW v2 AS SELECT * FROM t2;
PREPARE ps FROM '
SELECT a FROM t1, v2
WHERE ( c, b ) IN ( SELECT b, b FROM t2 )
GROUP BY a ';
EXECUTE ps;
a
y
z
EXECUTE ps;
a
y
z
DROP VIEW v2;
DROP TABLE t1, t2;
# This must be at the end: # This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp; set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level; set join_cache_level=@save_join_cache_level;
......
...@@ -2004,6 +2004,28 @@ a c ...@@ -2004,6 +2004,28 @@ a c
SET optimizer_switch=@save_optimizer_switch; SET optimizer_switch=@save_optimizer_switch;
SET join_cache_level=@save_join_cache_level; SET join_cache_level=@save_join_cache_level;
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# BUG#952297: Server crashes on 2nd execution of PS in Field::is_null with semijoin+materialization
#
CREATE TABLE t1 ( a VARCHAR(1) );
INSERT INTO t1 VALUES ('y'),('z');
CREATE TABLE t2 ( b VARCHAR(1), c VARCHAR(1) );
INSERT INTO t2 VALUES ('v','v'),('v','v');
CREATE VIEW v2 AS SELECT * FROM t2;
PREPARE ps FROM '
SELECT a FROM t1, v2
WHERE ( c, b ) IN ( SELECT b, b FROM t2 )
GROUP BY a ';
EXECUTE ps;
a
y
z
EXECUTE ps;
a
y
z
DROP VIEW v2;
DROP TABLE t1, t2;
# This must be at the end: # This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp; set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level; set join_cache_level=@save_join_cache_level;
...@@ -1642,6 +1642,28 @@ SET join_cache_level=@save_join_cache_level; ...@@ -1642,6 +1642,28 @@ SET join_cache_level=@save_join_cache_level;
DROP TABLE t1,t2; DROP TABLE t1,t2;
--echo #
--echo # BUG#952297: Server crashes on 2nd execution of PS in Field::is_null with semijoin+materialization
--echo #
CREATE TABLE t1 ( a VARCHAR(1) );
INSERT INTO t1 VALUES ('y'),('z');
CREATE TABLE t2 ( b VARCHAR(1), c VARCHAR(1) );
INSERT INTO t2 VALUES ('v','v'),('v','v');
CREATE VIEW v2 AS SELECT * FROM t2;
PREPARE ps FROM '
SELECT a FROM t1, v2
WHERE ( c, b ) IN ( SELECT b, b FROM t2 )
GROUP BY a ';
EXECUTE ps;
EXECUTE ps;
DROP VIEW v2;
DROP TABLE t1, t2;
--echo # This must be at the end: --echo # This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp; set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level; set join_cache_level=@save_join_cache_level;
......
...@@ -8506,6 +8506,17 @@ int setup_conds(THD *thd, TABLE_LIST *tables, List<TABLE_LIST> &leaves, ...@@ -8506,6 +8506,17 @@ int setup_conds(THD *thd, TABLE_LIST *tables, List<TABLE_LIST> &leaves,
goto err_no_arena; goto err_no_arena;
select_lex->cond_count++; select_lex->cond_count++;
} }
/*
If it's a semi-join nest, fix its "left expression", as it is used by
the SJ-Materialization
*/
if (embedded->sj_subq_pred)
{
Item **left_expr= &embedded->sj_subq_pred->left_expr;
if (!(*left_expr)->fixed && (*left_expr)->fix_fields(thd, left_expr))
goto err_no_arena;
}
embedding= embedded->embedding; embedding= embedded->embedding;
} }
while (embedding && while (embedding &&
......
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