summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorgkodinov/kgeorge@magare.gmz <>2007-04-20 12:01:54 +0300
committergkodinov/kgeorge@magare.gmz <>2007-04-20 12:01:54 +0300
commitbcde01f6ffbc7f3138d4d12ce93b9811744825bd (patch)
tree8b9891063984bd545816a21d34ff0e36dd0f5cb7 /sql
parentf0fc4b88e0a6eb6249106306f411ecab3e413a6c (diff)
parent4c89a5960fbd73c684b9f8d3a07ee8d78436b732 (diff)
downloadmariadb-git-bcde01f6ffbc7f3138d4d12ce93b9811744825bd.tar.gz
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B27786-5.0-opt
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_lex.h8
-rw-r--r--sql/sql_view.cc9
2 files changed, 15 insertions, 2 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
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 83beec3d1be..95dec40450f 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1263,13 +1263,18 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
unit->slave= save_slave; // fix include_down initialisation
}
+ /*
+ We can safely ignore the VIEW's ORDER BY if we merge into union
+ branch, as order is not important there.
+ */
+ if (!table->select_lex->master_unit()->is_union())
+ table->select_lex->order_list.push_back(&lex->select_lex.order_list);
/*
This SELECT_LEX will be linked in global SELECT_LEX list
to make it processed by mysql_handle_derived(),
but it will not be included to SELECT_LEX tree, because it
will not be executed
- */
- table->select_lex->order_list.push_back(&lex->select_lex.order_list);
+ */
goto ok;
}