summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-02-03 15:50:25 -0800
committerIgor Babaev <igor@askmonty.org>2017-02-03 15:50:25 -0800
commit20aae56efa5aba90893e602ea87af2f14d161b10 (patch)
tree4bc7a24424484ece548b4c1220cc6becd36b7c47 /sql/item_sum.cc
parentbc12d993d7bc94a9533028a258afc7e4ceb21e92 (diff)
downloadmariadb-git-20aae56efa5aba90893e602ea87af2f14d161b10.tar.gz
Fixed bug mdev-10660.
The method Item_sum::print did not print opening '(' after the name of simple window functions (like rank, dense_rank etc). As a result the view definitions with such window functions were formed invalid in .frm files.
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 23f8638b724..2ca1be31ae1 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -471,6 +471,13 @@ void Item_sum::print(String *str, enum_query_type query_type)
/* orig_args is not filled with valid values until fix_fields() */
Item **pargs= fixed ? orig_args : args;
str->append(func_name());
+ /*
+ TODO:
+ The fact that func_name() may return a name with an extra '('
+ is really annoying. This shoud be fixed.
+ */
+ if (!is_aggr_sum_func())
+ str->append('(');
for (uint i=0 ; i < arg_count ; i++)
{
if (i)
@@ -594,7 +601,9 @@ Item *Item_sum::result_item(THD *thd, Field *field)
bool Item_sum::check_vcol_func_processor(void *arg)
{
- return mark_unsupported_function(func_name(), ")", arg, VCOL_IMPOSSIBLE);
+ return mark_unsupported_function(func_name(),
+ is_aggr_sum_func() ? ")" : "()",
+ arg, VCOL_IMPOSSIBLE);
}