diff options
author | unknown <serg@serg.mylan> | 2004-03-23 14:43:24 +0100 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2004-03-23 14:43:24 +0100 |
commit | c0a9df1aaedc4a44299398b858021d49ccbfd2ea (patch) | |
tree | 303d154fcdcdeb732e85c89c418f9b45836d801e /sql/sql_union.cc | |
parent | 78b4ba746b79ea7d89044e3eecd56338a8f4eb6f (diff) | |
download | mariadb-git-c0a9df1aaedc4a44299398b858021d49ccbfd2ea.tar.gz |
correct support for a mix of UNION/UNION ALL in the same query.
Bug#1428
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 87f70bcbd3a..3a27e606cff 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -210,7 +210,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, union_result->tmp_table_param.field_count= types.elements; if (!(table= create_tmp_table(thd_arg, &union_result->tmp_table_param, types, - (ORDER*) 0, !union_option, 1, + (ORDER*) 0, union_distinct, 1, (first_select_in_union()->options | thd_arg->options | TMP_TABLE_ALL_COLUMNS), @@ -267,6 +267,8 @@ int st_select_lex_unit::exec() item->reset(); table->file->delete_all_rows(); } + if (union_distinct) // for subselects + table->file->extra(HA_EXTRA_CHANGE_KEY_TO_UNIQUE); for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select()) { ha_rows records_at_start= 0; @@ -317,6 +319,8 @@ int st_select_lex_unit::exec() { records_at_start= table->file->records; sl->join->exec(); + if (sl == union_distinct) + table->file->extra(HA_EXTRA_CHANGE_KEY_TO_DUP); res= sl->join->error; offset_limit_cnt= sl->offset_limit; if (!res && union_result->flush()) |