summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2001-08-24 13:18:06 +0300
committerunknown <Sinisa@sinisa.nasamreza.org>2001-08-24 13:18:06 +0300
commit9fc664547c5a531b67275d7b911d1920bb7a373a (patch)
tree6df0cabacf1fff01d50cf56a4df60335c4448183 /sql/sql_union.cc
parent765709dadcf1f2c9ff604ee30e2ec383e8cc6715 (diff)
downloadmariadb-git-9fc664547c5a531b67275d7b911d1920bb7a373a.tar.gz
EXPLAIN on UNION"s
mysql-test/r/union.result: New result for EXPLAIN UNION's mysql-test/t/union.test: No error when EXPLAIN is done on UNION's
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r--sql/sql_union.cc25
1 files changed, 19 insertions, 6 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index c2f1dbaa401..a0a6704b631 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -38,12 +38,6 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
uint elements;
DBUG_ENTER("mysql_union");
- if (lex->select_lex.options & SELECT_DESCRIBE)
- {
- my_error(ER_WRONG_USAGE,MYF(0),"DESCRIBE","UNION");
- return -1;
- }
-
/* Fix tables--to-be-unioned-from list to point at opened tables */
for (sl=&lex->select_lex; sl; sl=sl->next)
{
@@ -66,6 +60,25 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
}
}
+ if (lex->select_lex.options & SELECT_DESCRIBE)
+ {
+ for (sl= &lex->select_lex; sl; sl=sl->next)
+ {
+ lex->select=sl;
+ res=mysql_select(thd, (TABLE_LIST*) sl->table_list.first,
+ sl->item_list,
+ sl->where,
+ sl->ftfunc_list,
+ (ORDER*) 0,
+ (ORDER*) sl->group_list.first,
+ sl->having,
+ (ORDER*) NULL,
+ sl->options | thd->options | SELECT_NO_UNLOCK | SELECT_DESCRIBE,
+ result);
+ }
+ return 0;
+ }
+
order = (ORDER *) last_sl->order_list.first;
{
Item *item;