diff --git a/sql/item.h b/sql/item.h index 259b3654461..c9f87c4df90 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1467,7 +1467,10 @@ public: Field *get_tmp_table_field() { return result_field ? result_field : (*ref)->get_tmp_table_field(); } Item *get_tmp_table_item(THD *thd) - { return (*ref)->get_tmp_table_item(thd); } + { + return (result_field ? new Item_field(result_field) : + (*ref)->get_tmp_table_item(thd)); + } table_map used_tables() const { return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables();