diff options
author | unknown <evgen@moonbone.local> | 2005-10-13 16:00:26 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2005-10-13 16:00:26 +0400 |
commit | c621f477353cde297753a34213f2a523f5de94ad (patch) | |
tree | c3ff8f3ce55f07707f6b170abe4461207377dfd6 /sql/item.cc | |
parent | 1c4eab2de02a09d2618184f546d1b26c7d000636 (diff) | |
parent | f0a8cdff88d8eb8392ecf52bf5bf6fb429a46e2c (diff) | |
download | mariadb-git-c621f477353cde297753a34213f2a523f5de94ad.tar.gz |
Manual merge of bug fix #7672
sql/sql_lex.h:
Auto merged
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc index 5961db0bc1f..2fa77ac81c0 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3213,6 +3213,22 @@ bool Item_field::fix_fields(THD *thd, Item **reference) TRUE)) == 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, + ¬_used); + if (res != not_found_item && (*res)->type() == Item::FIELD_ITEM) + { + set_field((*((Item_field**)res))->field); + return 0; + } + } + /* If there are outer contexts (outer selects, but current select is not derived table or view) try to resolve this reference in the |