diff options
author | unknown <jimw@mysql.com> | 2005-02-04 11:59:02 -0800 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-02-04 11:59:02 -0800 |
commit | 1be345edc0cc351029dc207d836ced1742bdfd8d (patch) | |
tree | 51df5e0d0334e67749bc68845ba7a952061390a5 /sql/sql_union.cc | |
parent | 74ad9e8f1efde5295b9bf0b4bc4a3331d0faab4f (diff) | |
parent | 2f91118458995b9fe780aa7a5a664765572cdc30 (diff) | |
download | mariadb-git-1be345edc0cc351029dc207d836ced1742bdfd8d.tar.gz |
Merge changes
client/mysqlcheck.c:
Auto merged
myisam/ft_boolean_search.c:
Auto merged
myisam/ft_static.c:
Auto merged
mysql-test/r/func_group.result:
Auto merged
mysql-test/r/union.result:
Auto merged
mysql-test/t/func_group.test:
Auto merged
mysql-test/t/multi_update.test:
Auto merged
mysql-test/t/union.test:
Auto merged
scripts/make_binary_distribution.sh:
Auto merged
sql/ha_myisam.h:
Auto merged
sql/handler.h:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/sql_union.cc:
Auto merged
sql/field.cc:
Clean up merge
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 0a91eb4c0e1..29897c70023 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -153,6 +153,7 @@ bool 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); @@ -249,13 +250,21 @@ bool 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) @@ -274,7 +283,8 @@ bool 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(TRUE); } } |