throw an error when a subquery has grouping set clause

pull/2507/head
Hanefi Onaldi 2018-11-29 15:36:04 +03:00
parent 5a8c79430e
commit 088a2ef66a
3 changed files with 26 additions and 0 deletions

View File

@ -807,6 +807,14 @@ DeferErrorIfCannotPushdownSubquery(Query *subqueryTree, bool outerMostQueryHasLi
}
}
/* grouping sets are not allowed in subqueries*/
if (subqueryTree->groupingSets)
{
preconditionsSatisfied = false;
errorDetail = "could not run distributed query with GROUPING SETS, CUBE, "
"or ROLLUP";
}
/*
* We support window functions when the window function
* is partitioned on distribution column.

View File

@ -157,6 +157,17 @@ WHERE
;
ERROR: cannot push down this subquery
DETAIL: Having qual without group by on partition column is currently unsupported when a subquery references a column from another query
-- We do not support GROUPING SETS in subqueries
-- This also includes ROLLUP or CUBE clauses
SELECT * FROM (SELECT user_id, value_1 FROM users_table GROUP BY GROUPING SETS ((user_id), (value_1))) s;
ERROR: could not run distributed query with GROUPING SETS, CUBE, or ROLLUP
HINT: Consider using an equality filter on the distributed table's partition column.
SELECT * FROM (SELECT user_id, value_1 FROM users_table GROUP BY ROLLUP (user_id, value_1)) s;
ERROR: could not run distributed query with GROUPING SETS, CUBE, or ROLLUP
HINT: Consider using an equality filter on the distributed table's partition column.
SELECT * FROM (SELECT user_id, value_1 FROM users_table GROUP BY CUBE (user_id, value_1)) s;
ERROR: could not run distributed query with GROUPING SETS, CUBE, or ROLLUP
HINT: Consider using an equality filter on the distributed table's partition column.
SET client_min_messages TO DEFAULT;
DROP SCHEMA not_supported CASCADE;
NOTICE: drop cascades to table users_table_local

View File

@ -149,6 +149,13 @@ WHERE
)
;
-- We do not support GROUPING SETS in subqueries
-- This also includes ROLLUP or CUBE clauses
SELECT * FROM (SELECT user_id, value_1 FROM users_table GROUP BY GROUPING SETS ((user_id), (value_1))) s;
SELECT * FROM (SELECT user_id, value_1 FROM users_table GROUP BY ROLLUP (user_id, value_1)) s;
SELECT * FROM (SELECT user_id, value_1 FROM users_table GROUP BY CUBE (user_id, value_1)) s;
SET client_min_messages TO DEFAULT;
DROP SCHEMA not_supported CASCADE;