diff options
author | unknown <gluh@gluh.mysql.r18.ru> | 2005-02-04 15:31:36 +0300 |
---|---|---|
committer | unknown <gluh@gluh.mysql.r18.ru> | 2005-02-04 15:31:36 +0300 |
commit | 66eb71f3fc13fefaa6d72532b521a28c09138aa3 (patch) | |
tree | bbb0e40bc45b0aa18e65ab56858a6d4d78bd8c06 /sql/sql_union.cc | |
parent | 7116beb95dc5eddf704181a096fae37dde46fe38 (diff) | |
download | mariadb-git-66eb71f3fc13fefaa6d72532b521a28c09138aa3.tar.gz |
A fix: bug#6931: Date Type column problem when using UNION-Table
bug#7833: Wrong datatype of aggregate column is returned
mysql-test/r/func_group.result:
Test case for bug 7833: Wrong datatype of aggregate column is returned
mysql-test/r/union.result:
Test case for bug 6931: Date Type column problem when using UNION-Table.
mysql-test/t/func_group.test:
Test case for bug 7833: Wrong datatype of aggregate column is returned
mysql-test/t/union.test:
Test case for bug 6931: Date Type column problem when using UNION-Table.
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 027a21db7ac..882316d57d7 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -148,6 +148,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, SELECT_LEX *sl, *first_select; select_result *tmp_result; bool is_union; + TABLE *empty_table= 0; DBUG_ENTER("st_select_lex_unit::prepare"); describe= test(additional_options & SELECT_DESCRIBE); @@ -239,13 +240,21 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, goto err; if (sl == first_select) { + /* + We need to create an empty table object. It is used + to create tmp_table fields in Item_type_holder. + The main reason of this is that we can't create + field object without table. + */ + DBUG_ASSERT(!empty_table); + empty_table= (TABLE*) thd->calloc(sizeof(TABLE)); types.empty(); List_iterator_fast<Item> it(sl->item_list); Item *item_tmp; while ((item_tmp= it++)) { /* Error's in 'new' will be detected after loop */ - types.push_back(new Item_type_holder(thd_arg, item_tmp)); + types.push_back(new Item_type_holder(thd_arg, item_tmp, empty_table)); } if (thd_arg->is_fatal_error) @@ -264,7 +273,8 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, Item *type, *item_tmp; while ((type= tp++, item_tmp= it++)) { - if (((Item_type_holder*)type)->join_types(thd_arg, item_tmp)) + if (((Item_type_holder*)type)->join_types(thd_arg, item_tmp, + empty_table)) DBUG_RETURN(-1); } } |