mirror of https://github.com/citusdata/citus.git
parent
f6ea619e27
commit
5aedec4242
|
@ -1097,8 +1097,8 @@ RecursivelyPlanCTEs(Query *query, RecursivePlanningContext *planningContext)
|
|||
if (query->hasRecursive)
|
||||
{
|
||||
return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED,
|
||||
"recursive CTEs are not supported in distributed "
|
||||
"queries",
|
||||
"recursive CTEs are only supported when they "
|
||||
"contain a filter on the distribution column",
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ WITH RECURSIVE hierarchy as (
|
|||
h.company_id = ce.company_id))
|
||||
SELECT * FROM hierarchy WHERE LEVEL <= 2;
|
||||
DEBUG: Router planner cannot handle multi-shard select queries
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
-- logically wrong query, query involves different shards
|
||||
-- from the same table, but still router plannable due to
|
||||
-- shard being placed on the same worker.
|
||||
|
@ -386,7 +386,7 @@ WITH RECURSIVE hierarchy as (
|
|||
ce.company_id = 2))
|
||||
SELECT * FROM hierarchy WHERE LEVEL <= 2;
|
||||
DEBUG: router planner does not support queries that reference non-colocated distributed tables
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
-- grouping sets are supported on single shard
|
||||
SELECT
|
||||
id, substring(title, 2, 1) AS subtitle, count(*)
|
||||
|
|
|
@ -436,7 +436,7 @@ WITH RECURSIVE hierarchy as MATERIALIZED (
|
|||
h.company_id = ce.company_id))
|
||||
SELECT * FROM hierarchy WHERE LEVEL <= 2;
|
||||
DEBUG: Router planner cannot handle multi-shard select queries
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
-- logically wrong query, query involves different shards
|
||||
-- from the same table
|
||||
WITH RECURSIVE hierarchy as MATERIALIZED (
|
||||
|
@ -451,7 +451,7 @@ WITH RECURSIVE hierarchy as MATERIALIZED (
|
|||
ce.company_id = 2))
|
||||
SELECT * FROM hierarchy WHERE LEVEL <= 2;
|
||||
DEBUG: router planner does not support queries that reference non-colocated distributed tables
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
-- Test router modifying CTEs
|
||||
WITH new_article AS MATERIALIZED(
|
||||
INSERT INTO articles_hash VALUES (1, 1, 'arsenous', 9) RETURNING *
|
||||
|
|
|
@ -1142,7 +1142,7 @@ WITH RECURSIVE search_graph(f, t, label) AS (
|
|||
WHERE g.f = sg.t and g.f = 1
|
||||
) SEARCH DEPTH FIRST BY f, t SET seq
|
||||
SELECT * FROM search_graph ORDER BY seq;
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
WITH RECURSIVE search_graph(f, t, label) AS (
|
||||
SELECT * FROM graph0 g WHERE f = 1
|
||||
UNION ALL
|
||||
|
@ -1151,7 +1151,7 @@ WITH RECURSIVE search_graph(f, t, label) AS (
|
|||
WHERE g.f = sg.t and g.f = 1
|
||||
) SEARCH DEPTH FIRST BY f, t SET seq
|
||||
DELETE FROM graph0 WHERE t IN (SELECT t FROM search_graph ORDER BY seq);
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
CREATE TABLE graph1(f INT, t INT, label TEXT);
|
||||
SELECT create_reference_table('graph1');
|
||||
create_reference_table
|
||||
|
@ -1170,7 +1170,7 @@ WITH RECURSIVE search_graph(f, t, label) AS (
|
|||
WHERE g.f = sg.t and g.f = 1
|
||||
) SEARCH DEPTH FIRST BY f, t SET seq
|
||||
SELECT * FROM search_graph ORDER BY seq;
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
WITH RECURSIVE search_graph(f, t, label) AS (
|
||||
SELECT * FROM graph1 g WHERE f = 1
|
||||
UNION ALL
|
||||
|
@ -1179,7 +1179,7 @@ WITH RECURSIVE search_graph(f, t, label) AS (
|
|||
WHERE g.f = sg.t and g.f = 1
|
||||
) SEARCH DEPTH FIRST BY f, t SET seq
|
||||
DELETE FROM graph1 WHERE t IN (SELECT t FROM search_graph ORDER BY seq);
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
SELECT * FROM (
|
||||
WITH RECURSIVE search_graph(f, t, label) AS (
|
||||
SELECT *
|
||||
|
@ -1191,7 +1191,7 @@ SELECT * FROM (
|
|||
) SEARCH DEPTH FIRST BY f, t SET seq
|
||||
SELECT * FROM search_graph ORDER BY seq
|
||||
) as foo;
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
--
|
||||
-- https://github.com/citusdata/citus/issues/5258
|
||||
--
|
||||
|
|
|
@ -1529,7 +1529,7 @@ DEBUG: Router planner cannot handle multi-shard select queries
|
|||
DEBUG: Router planner cannot handle multi-shard select queries
|
||||
DEBUG: generating subplan XXX_1 for CTE level_1: WITH RECURSIVE level_2_recursive(x) AS (VALUES (1) UNION ALL SELECT (nullkey_c1_t1.a OPERATOR(pg_catalog.+) 1) FROM (query_single_shard_table.nullkey_c1_t1 JOIN level_2_recursive level_2_recursive_1 ON ((nullkey_c1_t1.a OPERATOR(pg_catalog.=) level_2_recursive_1.x))) WHERE (nullkey_c1_t1.a OPERATOR(pg_catalog.<) 100)) SELECT level_2_recursive.x, distributed_table.a, distributed_table.b FROM (level_2_recursive JOIN query_single_shard_table.distributed_table ON ((level_2_recursive.x OPERATOR(pg_catalog.=) distributed_table.a)))
|
||||
DEBUG: Router planner cannot handle multi-shard select queries
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
-- grouping set
|
||||
SELECT
|
||||
id, substring(title, 2, 1) AS subtitle, count(*)
|
||||
|
|
|
@ -527,7 +527,7 @@ FROM
|
|||
) as bar
|
||||
WHERE foo.user_id = bar.user_id
|
||||
ORDER BY 1 DESC;
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
CREATE TABLE ref_table_1 (a int);
|
||||
SELECT create_reference_table('ref_table_1');
|
||||
create_reference_table
|
||||
|
|
|
@ -664,14 +664,14 @@ WITH RECURSIVE basic_recursive(x) AS (
|
|||
SELECT user_id + 1 FROM users_table JOIN basic_recursive ON (user_id = x) WHERE user_id < 100
|
||||
)
|
||||
SELECT sum(x) FROM basic_recursive;
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
WITH RECURSIVE basic_recursive AS (
|
||||
SELECT -1 as user_id, '2017-11-22 20:16:16.614779'::timestamp, -1, -1, -1, -1
|
||||
UNION ALL
|
||||
SELECT basic_recursive.* FROM users_table JOIN basic_recursive USING (user_id) WHERE user_id>1
|
||||
)
|
||||
SELECT * FROM basic_recursive ORDER BY user_id LIMIT 1;
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
-- basic_recursive in FROM should error out
|
||||
SELECT
|
||||
*
|
||||
|
@ -682,7 +682,7 @@ FROM
|
|||
SELECT basic_recursive.* FROM users_table JOIN basic_recursive USING (user_id) WHERE user_id>1
|
||||
)
|
||||
SELECT * FROM basic_recursive ORDER BY user_id LIMIT 1) cte_rec;
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
-- basic_recursive in WHERE with UNION ALL
|
||||
SELECT
|
||||
*
|
||||
|
@ -696,7 +696,7 @@ WHERE
|
|||
SELECT basic_recursive.* FROM users_table JOIN basic_recursive USING (user_id) WHERE user_id>1
|
||||
)
|
||||
SELECT * FROM basic_recursive ORDER BY user_id LIMIT 1);
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
-- one recursive one regular CTE should error out
|
||||
WITH RECURSIVE basic_recursive(x) AS(
|
||||
VALUES (1)
|
||||
|
@ -707,7 +707,7 @@ basic AS (
|
|||
SELECT count(user_id) FROM users_table
|
||||
)
|
||||
SELECT x FROM basic, basic_recursive;
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
-- one recursive one regular which SELECTs from the recursive CTE under a simple SELECT
|
||||
WITH RECURSIVE basic_recursive(x) AS(
|
||||
VALUES (1)
|
||||
|
@ -718,7 +718,7 @@ basic AS (
|
|||
SELECT count(x) FROM basic_recursive
|
||||
)
|
||||
SELECT * FROM basic;
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
-- recursive CTE in a NESTED manner
|
||||
WITH regular_cte AS (
|
||||
WITH regular_2 AS (
|
||||
|
@ -732,7 +732,7 @@ WITH regular_cte AS (
|
|||
SELECT * FROM regular_2
|
||||
)
|
||||
SELECT * FROM regular_cte;
|
||||
ERROR: recursive CTEs are not supported in distributed queries
|
||||
ERROR: recursive CTEs are only supported when they contain a filter on the distribution column
|
||||
-- CTEs should work with VIEWs as well
|
||||
CREATE VIEW basic_view AS
|
||||
SELECT * FROM users_table;
|
||||
|
|
Loading…
Reference in New Issue