summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorigor@olga.mysql.com <>2007-03-04 19:54:35 -0800
committerigor@olga.mysql.com <>2007-03-04 19:54:35 -0800
commit08efa4e0ea99255dd9136b19222feff1165605ff (patch)
treee3016218c5b9fe171d206241d21c14d8ee662120 /sql/item.h
parent6274ee84b31a364bd7d0c5a8db9d5f49a2e45672 (diff)
downloadmariadb-git-08efa4e0ea99255dd9136b19222feff1165605ff.tar.gz
Fixed bug #26560.
The flag alias_name_used was not set on for the outer references in subqueries. It resulted in replacement of any outer reference resolved against an alias for a full field name when the frm representation of a view with a subquery was generated. If the subquery and the outer query referenced the same table in their from lists this replacement effectively changed the meaning of the view and led to wrong results for selects from this view. Modified several functions to ensure setting the right value of the alias_name_used flag for outer references resolved against aliases.
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/item.h b/sql/item.h
index d792f95055d..2a121523423 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1851,7 +1851,8 @@ public:
with Bar, and if we have a more broader set of problems like this.
*/
Item_ref(Name_resolution_context *context_arg, Item **item,
- const char *table_name_arg, const char *field_name_arg);
+ const char *table_name_arg, const char *field_name_arg,
+ bool alias_name_used_arg= FALSE);
/* Constructor need to process subselect with temporary tables (see Item) */
Item_ref(THD *thd, Item_ref *item)
@@ -1926,8 +1927,11 @@ class Item_direct_ref :public Item_ref
public:
Item_direct_ref(Name_resolution_context *context_arg, Item **item,
const char *table_name_arg,
- const char *field_name_arg)
- :Item_ref(context_arg, item, table_name_arg, field_name_arg) {}
+ const char *field_name_arg,
+ bool alias_name_used_arg= FALSE)
+ :Item_ref(context_arg, item, table_name_arg,
+ field_name_arg, alias_name_used_arg)
+ {}
/* Constructor need to process subselect with temporary tables (see Item) */
Item_direct_ref(THD *thd, Item_direct_ref *item) : Item_ref(thd, item) {}