summaryrefslogtreecommitdiff
path: root/sql/sql_lex.h
diff options
context:
space:
mode:
authorgkodinov/kgeorge@magare.gmz <>2007-04-20 10:49:45 +0300
committergkodinov/kgeorge@magare.gmz <>2007-04-20 10:49:45 +0300
commit4c89a5960fbd73c684b9f8d3a07ee8d78436b732 (patch)
treef2618b562d1def306f97b055790d0a9b303eb66f /sql/sql_lex.h
parent6ad81b4e1325e727e9d218b1783f5891f7ff0405 (diff)
downloadmariadb-git-4c89a5960fbd73c684b9f8d3a07ee8d78436b732.tar.gz
Bug #27786:
When merging views into the enclosing statement the ORDER BY clause of the view is merged to the parent's ORDER BY clause. However when the VIEW is merged into an UNION branch the ORDER BY should be ignored. Use of ORDER BY for individual SELECT statements implies nothing about the order in which the rows appear in the final result because UNION by default produces unordered set of rows. Fixed by ignoring the ORDER BY clause from the merge view when expanded in an UNION branch.
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r--sql/sql_lex.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index de7de0d46e9..2ff29d684d1 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -468,6 +468,7 @@ public:
bool change_result(select_subselect *result, select_subselect *old_result);
void set_limit(st_select_lex *values);
void set_thd(THD *thd_arg) { thd= thd_arg; }
+ inline bool is_union ();
friend void lex_start(THD *thd, uchar *buf, uint length);
friend int subselect_union_engine::exec();
@@ -700,6 +701,13 @@ public:
};
typedef class st_select_lex SELECT_LEX;
+
+inline bool st_select_lex_unit::is_union ()
+{
+ return first_select()->next_select() &&
+ first_select()->next_select()->linkage == UNION_TYPE;
+}
+
#define ALTER_ADD_COLUMN 1
#define ALTER_DROP_COLUMN 2
#define ALTER_CHANGE_COLUMN 4