diff options
author | unknown <gkodinov/kgeorge@magare.gmz> | 2008-01-09 16:52:11 +0200 |
---|---|---|
committer | unknown <gkodinov/kgeorge@magare.gmz> | 2008-01-09 16:52:11 +0200 |
commit | 693f81f0f3bb9f303b58b51b4cd9ac88e766dd72 (patch) | |
tree | 72636b621325ae869580867751de020b3f18d8d6 /sql/sql_base.cc | |
parent | b8c8ca6845d7fb2b44de03f32e41af5a5ec75a54 (diff) | |
parent | 06b68454eadd20cbc2af5b2bfa8389e85120c0a3 (diff) | |
download | mariadb-git-693f81f0f3bb9f303b58b51b4cd9ac88e766dd72.tar.gz |
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B33133-5.0-opt
sql/sql_base.cc:
Auto merged
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 e79e4db31d2..8190b3eeacd 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4254,7 +4254,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) { |