summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorigor@rurik.mysql.com <>2006-05-16 22:19:44 -0700
committerigor@rurik.mysql.com <>2006-05-16 22:19:44 -0700
commit767d25dabdcc16b7a453fc6e05c2f13767f310fe (patch)
treed7fa05843a827dc02a5bbdd17483c49825b1b95f /sql/item.cc
parent8648412531b85308aa8289b13bafe9bf043959f7 (diff)
downloadmariadb-git-767d25dabdcc16b7a453fc6e05c2f13767f310fe.tar.gz
Fixed bug #19573.
The select statement that specified a view could be slightly changed when the view was saved in a frm file. In particular references to an alias name in the HAVING clause could be substituted for the expression named by this alias. This could result in an error message for a query of the form SELECT * FROM <view>. Yet no such message appeared when executing the query specifying the view.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 51a2f9a24f3..62052547ee9 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -4840,7 +4840,16 @@ void Item_ref::cleanup()
void Item_ref::print(String *str)
{
if (ref)
- (*ref)->print(str);
+ {
+ if ((*ref)->type() != Item::CACHE_ITEM && ref_type() != VIEW_REF &&
+ name && alias_name_used)
+ {
+ THD *thd= current_thd;
+ append_identifier(thd, str, name, (uint) strlen(name));
+ }
+ else
+ (*ref)->print(str);
+ }
else
Item_ident::print(str);
}