mirror of https://github.com/citusdata/citus.git
unsupported subquery error messages are fixed
parent
dcafd1368b
commit
446893234a
|
@ -960,14 +960,16 @@ DeferErrorIfCannotPushdownSubquery(Query *subqueryTree, bool outerMostQueryHasLi
|
|||
if (subqueryTree->limitOffset)
|
||||
{
|
||||
preconditionsSatisfied = false;
|
||||
errorDetail = "Offset clause is currently unsupported";
|
||||
errorDetail = "Offset clause is currently unsupported when a subquery "
|
||||
"references a column from another query";
|
||||
}
|
||||
|
||||
/* limit is not supported when SubqueryPushdown is not set */
|
||||
if (subqueryTree->limitCount && !SubqueryPushdown)
|
||||
{
|
||||
preconditionsSatisfied = false;
|
||||
errorDetail = "Limit in subquery is currently unsupported";
|
||||
errorDetail = "Limit in subquery is currently unsupported when a "
|
||||
"subquery references a column from another query";
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1022,7 +1024,8 @@ DeferErrorIfCannotPushdownSubquery(Query *subqueryTree, bool outerMostQueryHasLi
|
|||
{
|
||||
preconditionsSatisfied = false;
|
||||
errorDetail = "Group by list without partition column is currently "
|
||||
"unsupported";
|
||||
"unsupported when a subquery references a column "
|
||||
"from another query";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1041,7 +1044,8 @@ DeferErrorIfCannotPushdownSubquery(Query *subqueryTree, bool outerMostQueryHasLi
|
|||
if (subqueryTree->hasAggs && (subqueryTree->groupClause == NULL))
|
||||
{
|
||||
preconditionsSatisfied = false;
|
||||
errorDetail = "Aggregates without group by are currently unsupported";
|
||||
errorDetail = "Aggregates without group by are currently unsupported "
|
||||
"when a subquery references a column from another query";
|
||||
}
|
||||
|
||||
/* having clause without group by on partition column is not supported */
|
||||
|
@ -1049,7 +1053,8 @@ DeferErrorIfCannotPushdownSubquery(Query *subqueryTree, bool outerMostQueryHasLi
|
|||
{
|
||||
preconditionsSatisfied = false;
|
||||
errorDetail = "Having qual without group by on partition column is "
|
||||
"currently unsupported";
|
||||
"currently unsupported when a subquery references "
|
||||
"a column from another query";
|
||||
}
|
||||
|
||||
/* distinct clause list must include partition column */
|
||||
|
|
|
@ -1213,7 +1213,7 @@ ORDER BY
|
|||
user_id
|
||||
limit 50;
|
||||
ERROR: cannot push down this subquery
|
||||
DETAIL: Limit in subquery is currently unsupported
|
||||
DETAIL: Limit in subquery is currently unsupported when a subquery references a column from another query
|
||||
-- we recursively plan some queries but fail in the end
|
||||
-- since some_users_data since it has a reference
|
||||
-- from an outer query which is not recursively planned
|
||||
|
@ -1250,7 +1250,7 @@ ORDER BY
|
|||
user_id
|
||||
limit 50;
|
||||
ERROR: cannot push down this subquery
|
||||
DETAIL: Limit in subquery is currently unsupported
|
||||
DETAIL: Limit in subquery is currently unsupported when a subquery references a column from another query
|
||||
-- LATERAL JOINs used with INNER JOINs
|
||||
SET citus.subquery_pushdown to ON;
|
||||
SELECT user_id, lastseen
|
||||
|
@ -1598,7 +1598,7 @@ ORDER BY
|
|||
user_id DESC
|
||||
LIMIT 10;
|
||||
ERROR: cannot push down this subquery
|
||||
DETAIL: Limit in subquery is currently unsupported
|
||||
DETAIL: Limit in subquery is currently unsupported when a subquery references a column from another query
|
||||
-- NESTED INNER JOINs
|
||||
SELECT
|
||||
count(*) AS value, "generated_group_field"
|
||||
|
@ -2200,7 +2200,7 @@ ORDER BY
|
|||
value_2 DESC, user_id DESC
|
||||
LIMIT 10;
|
||||
ERROR: cannot push down this subquery
|
||||
DETAIL: Limit in subquery is currently unsupported
|
||||
DETAIL: Limit in subquery is currently unsupported when a subquery references a column from another query
|
||||
-- lets test some unsupported set operations
|
||||
-- not supported since we use INTERSECT
|
||||
SELECT ("final_query"."event_types") as types, count(*) AS sumOfEventType
|
||||
|
|
|
@ -610,7 +610,7 @@ WHERE
|
|||
OFFSET 3
|
||||
);
|
||||
ERROR: cannot push down this subquery
|
||||
DETAIL: Offset clause is currently unsupported
|
||||
DETAIL: Offset clause is currently unsupported when a subquery references a column from another query
|
||||
-- we can detect unsupported subquerues even if they appear
|
||||
-- in WHERE subquery -> FROM subquery -> WHERE subquery
|
||||
-- but we can recursively plan that anyway
|
||||
|
|
|
@ -493,7 +493,7 @@ HAVING count(*) > 3
|
|||
ORDER BY user_id
|
||||
LIMIT 5;
|
||||
ERROR: cannot push down this subquery
|
||||
DETAIL: Group by list without partition column is currently unsupported
|
||||
DETAIL: Group by list without partition column is currently unsupported when a subquery references a column from another query
|
||||
-- similar query with slightly more complex group by
|
||||
-- though the error message is a bit confusing
|
||||
SELECT
|
||||
|
@ -516,4 +516,4 @@ HAVING count(*) > 3
|
|||
ORDER BY user_id
|
||||
LIMIT 5;
|
||||
ERROR: cannot push down this subquery
|
||||
DETAIL: Group by list without partition column is currently unsupported
|
||||
DETAIL: Group by list without partition column is currently unsupported when a subquery references a column from another query
|
||||
|
|
|
@ -143,6 +143,46 @@ DEBUG: generating subplan 17_1 for subquery SELECT users_table.value_2 FROM pub
|
|||
DEBUG: Plan 17 query after replacing subqueries and CTEs: SELECT foo.value_2 FROM ((SELECT intermediate_result.value_2 FROM read_intermediate_result('17_1'::text, 'binary'::citus_copy_format) intermediate_result(value_2 integer)) foo LEFT JOIN (SELECT users_table.value_2 FROM public.users_table, public.events_table WHERE ((users_table.user_id = events_table.user_id) AND (events_table.event_type = ANY (ARRAY[5, 6, 7, 8])))) bar ON ((foo.value_2 = bar.value_2)))
|
||||
ERROR: cannot pushdown the subquery
|
||||
DETAIL: Complex subqueries and CTEs cannot be in the outer part of the outer join
|
||||
-- Aggregates in subquery without partition column can be planned recursively
|
||||
-- unless there is a reference to an outer query
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
users_table
|
||||
WHERE
|
||||
user_id IN
|
||||
(
|
||||
SELECT
|
||||
SUM(events_table.user_id)
|
||||
FROM
|
||||
events_table
|
||||
WHERE
|
||||
users_table.user_id = events_table.user_id
|
||||
)
|
||||
;
|
||||
ERROR: cannot push down this subquery
|
||||
DETAIL: Aggregates without group by are currently unsupported when a subquery references a column from another query
|
||||
-- Having qual without group by on partition column can be planned recursively
|
||||
-- unless there is a reference to an outer query
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
users_table
|
||||
WHERE
|
||||
user_id IN
|
||||
(
|
||||
SELECT
|
||||
SUM(events_table.user_id)
|
||||
FROM
|
||||
events_table
|
||||
WHERE
|
||||
events_table.user_id = users_table.user_id
|
||||
HAVING
|
||||
MIN(value_2) > 2
|
||||
)
|
||||
;
|
||||
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
|
||||
SET client_min_messages TO DEFAULT;
|
||||
DROP SCHEMA not_supported CASCADE;
|
||||
NOTICE: drop cascades to table users_table_local
|
||||
|
|
|
@ -131,7 +131,47 @@ FROM
|
|||
(SELECT users_table.value_2 FROM users_table, events_table WHERE users_table.user_id = events_table.user_id AND event_type IN (5,6,7,8)) as bar
|
||||
ON(foo.value_2 = bar.value_2);
|
||||
|
||||
|
||||
-- Aggregates in subquery without partition column can be planned recursively
|
||||
-- unless there is a reference to an outer query
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
users_table
|
||||
WHERE
|
||||
user_id IN
|
||||
(
|
||||
SELECT
|
||||
SUM(events_table.user_id)
|
||||
FROM
|
||||
events_table
|
||||
WHERE
|
||||
users_table.user_id = events_table.user_id
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
-- Having qual without group by on partition column can be planned recursively
|
||||
-- unless there is a reference to an outer query
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
users_table
|
||||
WHERE
|
||||
user_id IN
|
||||
(
|
||||
SELECT
|
||||
SUM(events_table.user_id)
|
||||
FROM
|
||||
events_table
|
||||
WHERE
|
||||
events_table.user_id = users_table.user_id
|
||||
HAVING
|
||||
MIN(value_2) > 2
|
||||
)
|
||||
;
|
||||
|
||||
SET client_min_messages TO DEFAULT;
|
||||
|
||||
DROP SCHEMA not_supported CASCADE;
|
||||
SET search_path TO public;
|
||||
SET search_path TO public;
|
||||
|
|
Loading…
Reference in New Issue