summaryrefslogtreecommitdiff
path: root/sql/sql_derived.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2005-02-14 02:06:21 +0200
committerunknown <bell@sanja.is.com.ua>2005-02-14 02:06:21 +0200
commitf048032c6843548ca6c04d78b2dd77ff5eddbe9e (patch)
tree4000a0d8fc719b79d7ee8435de7d980605d7b717 /sql/sql_derived.cc
parent0d57871425c1a4a2b469cecad92e1ce41ba9b572 (diff)
downloadmariadb-git-f048032c6843548ca6c04d78b2dd77ff5eddbe9e.tar.gz
removed wrong distinct UNION detection (BUG#6565)
mysql-test/r/derived.result: test of union subquery in the FROM clause with complex distinct/all mysql-test/t/derived.test: test of union subquery in the FROM clause with complex distinct/all sql/sql_derived.cc: removed wrong distinct UNION detection
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r--sql/sql_derived.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 9475ec08c96..3e627243b9f 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -132,10 +132,16 @@ static int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
/*
Temp table is created so that it hounours if UNION without ALL is to be
processed
+
+ As 'distinct' parameter we always pass FALSE (0), because underlying
+ query will control distinct condition by itself. Correct test of
+ distinct underlying query will be is_union &&
+ !unit->union_distinct->next_select() (i.e. it is union and last distinct
+ SELECT is last SELECT of UNION).
*/
if (!(table= create_tmp_table(thd, &derived_result->tmp_table_param,
- unit->types, (ORDER*) 0,
- is_union && unit->union_distinct, 1,
+ unit->types, (ORDER*) 0,
+ FALSE, 1,
(first_select->options | thd->options |
TMP_TABLE_ALL_COLUMNS),
HA_POS_ERROR,