Commit 0264ade4 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

fixed LIMIT clause printing (BUG#4839)

parent 618e65cd
...@@ -1042,3 +1042,8 @@ SHOW TABLES; ...@@ -1042,3 +1042,8 @@ SHOW TABLES;
Tables_in_test table_type Tables_in_test table_type
t2 BASE TABLE t2 BASE TABLE
v4 VIEW v4 VIEW
CREATE VIEW v1 AS SELECT EXISTS (SELECT 1 UNION SELECT 2);
select * from v1;
EXISTS (SELECT 1 UNION SELECT 2)
1
drop view v1;
...@@ -980,3 +980,10 @@ drop table t1; ...@@ -980,3 +980,10 @@ drop table t1;
-- error 1096 -- error 1096
CREATE VIEW v02 AS SELECT * FROM DUAL; CREATE VIEW v02 AS SELECT * FROM DUAL;
SHOW TABLES; SHOW TABLES;
#
# EXISTS with UNION VIEW
#
CREATE VIEW v1 AS SELECT EXISTS (SELECT 1 UNION SELECT 2);
select * from v1;
drop view v1;
...@@ -1481,8 +1481,9 @@ void st_select_lex::print_order(String *str, ORDER *order) ...@@ -1481,8 +1481,9 @@ void st_select_lex::print_order(String *str, ORDER *order)
void st_select_lex::print_limit(THD *thd, String *str) void st_select_lex::print_limit(THD *thd, String *str)
{ {
Item_subselect *item= master_unit()->item; SELECT_LEX_UNIT *unit= master_unit();
if (item && Item_subselect *item= unit->item;
if (item && unit->global_parameters == this &&
(item->substype() == Item_subselect::EXISTS_SUBS || (item->substype() == Item_subselect::EXISTS_SUBS ||
item->substype() == Item_subselect::IN_SUBS || item->substype() == Item_subselect::IN_SUBS ||
item->substype() == Item_subselect::ALL_SUBS)) item->substype() == Item_subselect::ALL_SUBS))
......
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