mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user