diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 7f6e0fbfafc..6dc4cbe16ec 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -3186,6 +3186,7 @@ bool Item_exists_subselect::exists2in_processor(void *opt_arg) set_exists_transformed(); first_select->select_limit= NULL; + first_select->explicit_limit= FALSE; if (!(in_subs= new (thd->mem_root) Item_in_subselect(thd, left_exp, first_select))) { diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30408.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30408.result new file mode 100644 index 00000000000..aa44e683102 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30408.result @@ -0,0 +1,30 @@ +for master_1 +for child2 +for child3 +set @@optimizer_switch="semijoin=off"; +set spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +create table ten(a int primary key); +insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int); +insert into t2 select a,a from ten; +create table t1 (a int, b int) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +select a.a, a.b from t1 a where exists (select * from t1 b where b.b = a.b); +a b +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +drop table ten, t1, t2; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30408.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30408.test new file mode 100644 index 00000000000..8f76c1209b6 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30408.test @@ -0,0 +1,26 @@ +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +set @@optimizer_switch="semijoin=off"; +set spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +create table ten(a int primary key); +insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int); +insert into t2 select a,a from ten; +create table t1 (a int, b int) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +select a.a, a.b from t1 a where exists (select * from t1 b where b.b = a.b); +drop table ten, t1, t2; +drop server srv; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log