summaryrefslogtreecommitdiff
path: root/mysql-test/r/parser.result
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2017-02-07 14:02:25 +0200
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2017-02-14 07:46:58 +0200
commitf675eab7dc7f1eb4f4b61bfdd548d9e8052678a4 (patch)
tree32fd41832a7ebc582b35d0bde24ce663b8d3ce2f /mysql-test/r/parser.result
parentfdfdea40f1b9d029de59131f54096c1b044ffdfa (diff)
downloadmariadb-git-f675eab7dc7f1eb4f4b61bfdd548d9e8052678a4.tar.gz
MDEV-10122: MariaDB does not support group functions in some contexts where MySQL does
The problematic queries involve unions. For unions we have an optimization where we skip the ORDER BY clause in a query from one side of the union if it will be performed later due to UNION. EX: (SELECT a from t1 ORDER BY a) ORDER BY b; The first ordering by a is not necessary and it gets removed. The problem is that we still need to resolve the Items before removing the ORDER BY list from the SELECT_LEX structure. During this final resolve step however, we forgot to allow SET functions within the ORDER BY clause. This caused us to return an "Invalid use of group function" error during the checking performed by fix_fields in Item_sum::init_sum_func_check.
Diffstat (limited to 'mysql-test/r/parser.result')
-rw-r--r--mysql-test/r/parser.result18
1 files changed, 14 insertions, 4 deletions
diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result
index cfca156f3d6..6029a976ba3 100644
--- a/mysql-test/r/parser.result
+++ b/mysql-test/r/parser.result
@@ -951,13 +951,23 @@ a
10
20
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a));
-ERROR HY000: Invalid use of group function
+a
+1
+10
+20
+30
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) LIMIT 1;
-ERROR HY000: Invalid use of group function
+a
+1
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a;
-ERROR HY000: Invalid use of group function
+a
+1
+10
+20
+30
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
-ERROR HY000: Invalid use of group function
+a
+1
DROP TABLE t1;
# UNION with a parenthesized term with ROLLUP
CREATE TABLE t1 (a INT);