mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
fix for a bug with UNION in sub-select's and start working on
UNION's in derived tables
This commit is contained in:
@@ -201,3 +201,6 @@ set SQL_SELECT_LIMIT=DEFAULT;
|
|||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
select * union select 1;
|
select * union select 1;
|
||||||
No tables used
|
No tables used
|
||||||
|
select 1 as a,(select a union select a);
|
||||||
|
a (select a union select a)
|
||||||
|
1 1
|
||||||
|
@@ -103,3 +103,4 @@ drop table t1,t2;
|
|||||||
|
|
||||||
--error 1096
|
--error 1096
|
||||||
select * union select 1;
|
select * union select 1;
|
||||||
|
select 1 as a,(select a union select a);
|
||||||
|
@@ -125,6 +125,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result)
|
|||||||
SELECT_LEX_NODE *lex_select_save= thd->lex.current_select;
|
SELECT_LEX_NODE *lex_select_save= thd->lex.current_select;
|
||||||
SELECT_LEX *sl;
|
SELECT_LEX *sl;
|
||||||
|
|
||||||
|
if (lex_select_save->linkage != DERIVED_TABLE_TYPE)
|
||||||
|
thd->lex.current_select=first_select();
|
||||||
/* Global option */
|
/* Global option */
|
||||||
if (((void*)(global_parameters)) == ((void*)this))
|
if (((void*)(global_parameters)) == ((void*)this))
|
||||||
{
|
{
|
||||||
|
@@ -2504,7 +2504,7 @@ select_derived:
|
|||||||
mysql_init_select(lex);
|
mysql_init_select(lex);
|
||||||
lex->current_select->linkage= DERIVED_TABLE_TYPE;
|
lex->current_select->linkage= DERIVED_TABLE_TYPE;
|
||||||
}
|
}
|
||||||
select_options select_item_list opt_select_from
|
select_options select_item_list opt_select_from union_opt
|
||||||
;
|
;
|
||||||
|
|
||||||
opt_outer:
|
opt_outer:
|
||||||
|
Reference in New Issue
Block a user