summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2007-09-28 23:24:40 +0000
committerevgen@moonbone.local <>2007-09-28 23:24:40 +0000
commitb9e81c2ae3f838194f181b8fb1b389dd42334211 (patch)
tree8eac86ce3439f35209aaa770d4d2cb7e11a96297 /sql/sql_select.cc
parentfca2a0c4acb8c92b0be667cc7a934d5abb10be4e (diff)
downloadmariadb-git-b9e81c2ae3f838194f181b8fb1b389dd42334211.tar.gz
Bug#27990: Wrong info in MYSQL_FIELD struct members when a tmp table was used.
The change_to_use_tmp_fields function leaves the orig_table member of an expression's tmp table field filled for the new Item_field being created. Later orig_table is used by the Field::make_field function to provide some info about original table and field name to a user. This is ok for a field but for an expression it should be empty. The change_to_use_tmp_fields function now resets orig_table member of an expression's tmp table field to prevent providing a wrong info to a user. The Field::make_field function now resets the table_name and the org_col_name variables when the orig_table is set to 0.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 08780efbedb..cc6184c6206 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -14119,6 +14119,9 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
item_field= (Item*) new Item_field(field);
if (!item_field)
DBUG_RETURN(TRUE); // Fatal error
+
+ if (item->real_item()->type() != Item::FIELD_ITEM)
+ field->orig_table= 0;
item_field->name= item->name;
#ifndef DBUG_OFF
if (_db_on_ && !item_field->name)