summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-06-20 12:25:07 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-06-20 12:25:07 +0500
commite855bf33b36586c4abca0b905608682f21752b75 (patch)
treee162ae4184c77818fe0e9da47c77391b89a59664 /sql/sql_select.cc
parentbcd6183fe7f242648ce6e04c8224c98531f1cbff (diff)
downloadmariadb-git-e855bf33b36586c4abca0b905608682f21752b75.tar.gz
Fixed bug #28898.
For a join query with GROUP BY and/or ORDER BY and a view reference in the FROM list the metadata erroneously showed empty table aliases and database names for the view columns. sql/item.h: Fixed bug #28898. Body of Item_ref::get_tmp_table_item method has been moved to item.cc file. mysql-test/t/metadata.test: Updated test case for bug #28898. sql/item.cc: Fixed bug #28898. The Item_ref::get_tmp_table_item method has been modified to copy pointers to the table alias and database name to the new Item_field object created for a field stored in the temporary table. mysql-test/r/metadata.result: Updated test case for bug #28898. sql/sql_select.cc: Fixed bug #28898. The change_to_use_tmp_fields function has been modified to to copy pointers to the table alias and database name from the Item_ref objects to the new Item_field objects created for fields stored in the temporary table.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6bff302f7f8..d962518495f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -14241,6 +14241,13 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
if (!item_field)
DBUG_RETURN(TRUE); // Fatal error
item_field->name= item->name;
+ if (item->type() == Item::REF_ITEM)
+ {
+ Item_field *ifield= (Item_field *) item_field;
+ Item_ref *iref= (Item_ref *) item;
+ ifield->table_name= iref->table_name;
+ ifield->db_name= iref->db_name;
+ }
#ifndef DBUG_OFF
if (_db_on_ && !item_field->name)
{