summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2019-05-02 14:38:43 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2019-05-03 08:50:40 +0530
commit879878e43d5ffd2bf4d18ffe4d0186f8926e58ca (patch)
tree7f21d3d6b599d24d83fe00f597fd513095fa80be /sql/item_sum.cc
parent5182348316bfe5a3b78484caf76875a5aaa77f5f (diff)
downloadmariadb-git-879878e43d5ffd2bf4d18ffe4d0186f8926e58ca.tar.gz
MDEV-18943: Group Concat with limit not working with views
Adjusted the Item_func_group_concat::print function to take into account limit if present with GROUP_CONCAT
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 4e449198fe0..ce0c9d3e944 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -4172,7 +4172,19 @@ void Item_func_group_concat::print(String *str, enum_query_type query_type)
}
str->append(STRING_WITH_LEN(" separator \'"));
str->append_for_single_quote(separator->ptr(), separator->length());
- str->append(STRING_WITH_LEN("\')"));
+ str->append(STRING_WITH_LEN("\'"));
+
+ if (limit_clause)
+ {
+ str->append(STRING_WITH_LEN(" limit "));
+ if (offset_limit)
+ {
+ offset_limit->print(str, query_type);
+ str->append(',');
+ }
+ row_limit->print(str, query_type);
+ }
+ str->append(STRING_WITH_LEN(")"));
}