summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorholyfoot/hf@deer.(none) <>2006-11-19 22:26:36 +0400
committerholyfoot/hf@deer.(none) <>2006-11-19 22:26:36 +0400
commit989117071a88569d374e9c3291d82479a0a19699 (patch)
tree4cc9e562442c1f919e665d747203f83c48971d1c /sql/sql_select.cc
parentbc840a7f8ee4d556e90684a3de58e6002a44f6f0 (diff)
parentdac2d0fcbaae370008175a992d1490c9169a3e89 (diff)
downloadmariadb-git-989117071a88569d374e9c3291d82479a0a19699.tar.gz
Merge mysql.com:/home/hf/work/mysql-5.0-0mrg
into mysql.com:/home/hf/work/mysql-5.1-mrg
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ad0cad0631c..231a760453c 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -13833,9 +13833,16 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
if (real_pos->type() == Item::FIELD_ITEM)
{
Item_field *item;
- pos= real_pos;
- if (!(item= new Item_field(thd, ((Item_field*) pos))))
+ if (!(item= new Item_field(thd, ((Item_field*) real_pos))))
goto err;
+ if (pos->type() == Item::REF_ITEM)
+ {
+ /* preserve the names of the ref when dereferncing */
+ Item_ref *ref= (Item_ref *) pos;
+ item->db_name= ref->db_name;
+ item->table_name= ref->table_name;
+ item->name= ref->name;
+ }
pos= item;
if (item->field->flags & BLOB_FLAG)
{