diff options
author | unknown <tsmith@ramayana.hindu.god> | 2008-01-22 15:56:15 -0700 |
---|---|---|
committer | unknown <tsmith@ramayana.hindu.god> | 2008-01-22 15:56:15 -0700 |
commit | 6c26935035ce6fc646fc448dc181d9a3a870cd54 (patch) | |
tree | 22de11d4d65b9eb7c56b5e80669f19cf9ff242f4 /sql/sql_base.cc | |
parent | 74c9f82afb1d145636b91eff4b26131fd60e4f68 (diff) | |
parent | 37ff91b3bfdb946743e36ddd13bfda71598f45a8 (diff) | |
download | mariadb-git-6c26935035ce6fc646fc448dc181d9a3a870cd54.tar.gz |
Merge ramayana.hindu.god:/home/tsmith/m/bk/51
into ramayana.hindu.god:/home/tsmith/m/bk/maint/51
client/mysqldump.c:
Auto merged
configure.in:
Auto merged
sql/field.cc:
Auto merged
sql/filesort.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/log.cc:
Auto merged
sql/repl_failsafe.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/item_sum.cc:
Manual merge.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 9e4dceff87d..41596b4faf2 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -6400,7 +6400,36 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter, *resolution= RESOLVED_IGNORING_ALIAS; break; } - } + } + else if (table_name && item->type() == Item::REF_ITEM && + ((Item_ref *)item)->ref_type() == Item_ref::VIEW_REF) + { + /* + TODO:Here we process prefixed view references only. What we should + really do is process all types of Item_refs. But this will currently + lead to a clash with the way references to outer SELECTs (from the + HAVING clause) are handled in e.g. : + SELECT 1 FROM t1 AS t1_o GROUP BY a + HAVING (SELECT t1_o.a FROM t1 AS t1_i GROUP BY t1_i.a LIMIT 1). + Processing all Item_refs here will cause t1_o.a to resolve to itself. + We still need to process the special case of Item_direct_view_ref + because in the context of views they have the same meaning as + Item_field for tables. + */ + Item_ident *item_ref= (Item_ident *) item; + if (item_ref->name && item_ref->table_name && + !my_strcasecmp(system_charset_info, item_ref->name, field_name) && + !my_strcasecmp(table_alias_charset, item_ref->table_name, + table_name) && + (!db_name || (item_ref->db_name && + !strcmp (item_ref->db_name, db_name)))) + { + found= li.ref(); + *counter= i; + *resolution= RESOLVED_IGNORING_ALIAS; + break; + } + } } if (!found) { |