Skip to content

Commit 4b08b10

Browse files
committed
MDEV-9489:Assertion `0' failed in Protocol::end_statement() on UNION ALL
Restoring currect_select fixed.
1 parent fd8e846 commit 4b08b10

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

mysql-test/r/subselect_mat.result

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,3 +2518,18 @@ a b sq
25182518
4 4 1
25192519
4 2 1
25202520
drop table t1, t2;
2521+
#
2522+
# MDEV-9489: Assertion `0' failed in Protocol::end_statement() on
2523+
# UNION ALL
2524+
#
2525+
CREATE TABLE t1 (f1 INT);
2526+
CREATE TABLE t2 (f2 INT);
2527+
INSERT INTO t1 VALUES (1),(2);
2528+
( SELECT 1 FROM t1 WHERE f1 NOT IN ( SELECT f2 FROM t2 ) LIMIT 0 )
2529+
UNION ALL
2530+
( SELECT 1 FROM t1 WHERE f1 NOT IN ( SELECT f2 FROM t2 ) )
2531+
;
2532+
1
2533+
1
2534+
1
2535+
drop table t1, t2;

mysql-test/t/subselect_mat.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,19 @@ SELECT a, b, (a, b) NOT IN (SELECT a, b FROM t2) as sq
254254
FROM t1;
255255

256256
drop table t1, t2;
257+
258+
--echo #
259+
--echo # MDEV-9489: Assertion `0' failed in Protocol::end_statement() on
260+
--echo # UNION ALL
261+
--echo #
262+
263+
CREATE TABLE t1 (f1 INT);
264+
CREATE TABLE t2 (f2 INT);
265+
INSERT INTO t1 VALUES (1),(2);
266+
267+
( SELECT 1 FROM t1 WHERE f1 NOT IN ( SELECT f2 FROM t2 ) LIMIT 0 )
268+
UNION ALL
269+
( SELECT 1 FROM t1 WHERE f1 NOT IN ( SELECT f2 FROM t2 ) )
270+
;
271+
272+
drop table t1, t2;

sql/item_subselect.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5328,6 +5328,7 @@ int subselect_hash_sj_engine::exec()
53285328
item_in->reset();
53295329
item_in->make_const();
53305330
item_in->set_first_execution();
5331+
thd->lex->current_select= save_select;
53315332
DBUG_RETURN(FALSE);
53325333
}
53335334

@@ -5371,6 +5372,7 @@ int subselect_hash_sj_engine::exec()
53715372
item_in->null_value= 1;
53725373
item_in->make_const();
53735374
item_in->set_first_execution();
5375+
thd->lex->current_select= save_select;
53745376
DBUG_RETURN(FALSE);
53755377
}
53765378

0 commit comments

Comments
 (0)