Commit 248d7108 authored by unknown's avatar unknown

fixed LIMIT clause printing (BUG#4839)


mysql-test/r/view.result:
  EXISTS with UNION VIEW creation test
mysql-test/t/view.test:
  EXISTS with UNION VIEW creation test
sql/sql_lex.cc:
  fixed LIMIT clause printing
parent 9ca63e55
...@@ -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