summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2005-10-13 01:14:58 +0400
committerunknown <evgen@moonbone.local>2005-10-13 01:14:58 +0400
commitd68f16e215f433b07b1ecf83f0296fdcaae50e65 (patch)
treeb77259961605cd1aaea5d8074508e6b261e01c60 /sql/item.cc
parent3b3712fda36883b238d7138b4049979cb87297bd (diff)
parenta46e8e230e7aaa4d338364154af514ed342d05f3 (diff)
downloadmariadb-git-d68f16e215f433b07b1ecf83f0296fdcaae50e65.tar.gz
Manual merged
sql/item.cc: Auto merged
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 7419bc173d5..d284af2b9f1 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1760,6 +1760,21 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if ((tmp= find_field_in_tables(thd, this, tables, &where, 0)) ==
not_found_field)
{
+ /* Look up in current select's item_list to find aliased fields */
+ if (thd->lex->current_select->is_item_list_lookup)
+ {
+ uint counter;
+ bool not_used;
+ Item** res= find_item_in_list(this, thd->lex->current_select->item_list,
+ &counter, REPORT_EXCEPT_NOT_FOUND,
+ &not_used);
+ if (res != not_found_item && (*res)->type() == Item::FIELD_ITEM)
+ {
+ set_field((*((Item_field**)res))->field);
+ return 0;
+ }
+ }
+
/*
We can't find table field in table list of current select,
consequently we have to find it in outer subselect(s).