summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 833f36dbe9f..4df3178c1f8 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -995,7 +995,8 @@ void st_select_lex::init_select()
use_index.empty();
ftfunc_list_alloc.empty();
ftfunc_list= &ftfunc_list_alloc;
- linkage= UNSPECIFIED_TYPE;
+ if (linkage != UNION_TYPE)
+ linkage= UNSPECIFIED_TYPE;
}
/*
@@ -1206,7 +1207,7 @@ bool st_select_lex_unit::create_total_list_n_last_return(THD *thd, st_lex *lex,
net_printf(thd,ER_WRONG_USAGE,"UNION","ORDER BY");
return 1;
}
- if (sl->linkage == DERIVED_TABLE_TYPE)
+ if (sl->linkage == DERIVED_TABLE_TYPE && !sl->next_select())
continue;
for (SELECT_LEX_UNIT *inner= sl->first_inner_unit();
inner;