summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2003-12-06 23:37:24 +0400
committerunknown <hf@deer.(none)>2003-12-06 23:37:24 +0400
commit859f599e1ed8a85b6c8909b32fdfa5dc223e929b (patch)
treec197ea3c314656fc5c4d9c91c3bfca2b8f7deeba /sql
parent07de836b44434cbab033d02cc47879275080f65c (diff)
downloadmariadb-git-859f599e1ed8a85b6c8909b32fdfa5dc223e929b.tar.gz
Fix for #1992
This bug happens when a query, having subselects in the fields list, needs temporary table. Item_subselect::get_tmp_table_item isn't implemented and just returns *this. So the tmp_table_item takes value not from temporary but from original table. mysql-test/r/subselect.result: appropriate test result added mysql-test/t/subselect.test: test case added sql/item_subselect.cc: Item_subselect::get_tmp_table_item implementation sql/item_subselect.h: Item_subselect::get_tmp_table_item declaration
Diffstat (limited to 'sql')
-rw-r--r--sql/item_subselect.cc6
-rw-r--r--sql/item_subselect.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 7b401b50d4c..123362b917b 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -166,6 +166,12 @@ bool Item_subselect::const_item() const
return const_item_cache;
}
+Item *Item_subselect::get_tmp_table_item(THD *thd)
+{
+ if (!with_sum_func && !const_item())
+ return new Item_field(result_field);
+ return copy_or_same(thd);
+}
void Item_subselect::update_used_tables()
{
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 8444dc7bf66..84f5de5a622 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -89,6 +89,7 @@ public:
bool const_item() const;
inline table_map get_used_tables_cache() { return used_tables_cache; }
inline bool get_const_item_cache() { return const_item_cache; }
+ Item *get_tmp_table_item(THD *thd);
void update_used_tables();
void print(String *str);
bool change_engine(subselect_engine *eng)