diff options
author | igor@rurik.mysql.com <> | 2006-05-16 22:19:44 -0700 |
---|---|---|
committer | igor@rurik.mysql.com <> | 2006-05-16 22:19:44 -0700 |
commit | 767d25dabdcc16b7a453fc6e05c2f13767f310fe (patch) | |
tree | d7fa05843a827dc02a5bbdd17483c49825b1b95f /sql/item.cc | |
parent | 8648412531b85308aa8289b13bafe9bf043959f7 (diff) | |
download | mariadb-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.cc | 11 |
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); } |