diff --git a/src/test/regress/expected/multi_insert_select_conflict.out b/src/test/regress/expected/multi_insert_select_conflict.out index 400f60669..d069cf7d3 100644 --- a/src/test/regress/expected/multi_insert_select_conflict.out +++ b/src/test/regress/expected/multi_insert_select_conflict.out @@ -274,8 +274,9 @@ DEBUG: generating subplan XXX_1 for CTE basic: SELECT col_1, col_2 FROM on_conf DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT col_1, col_2 FROM (SELECT basic.col_1, basic.col_2 FROM (SELECT intermediate_result.col_1, intermediate_result.col_2 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(col_1 integer, col_2 integer)) basic) citus_insert_select_subquery DEBUG: Collecting INSERT ... SELECT results on coordinator RESET client_min_messages; --- Following query is not supported since error checks of the subquery pushdown planner --- and insert select planner have not been unified. It should work after unifying them. +-- Following query is supported by using repartition join for the insert/select +SELECT coordinator_plan($Q$ +EXPLAIN (costs off) WITH cte AS ( SELECT col_1, col_2 @@ -288,8 +289,17 @@ SELECT source_table_1.col_2 FROM cte, source_table_1 WHERE cte.col_1 = source_table_1.col_1 ON CONFLICT DO NOTHING; -ERROR: cannot perform distributed planning for the given modification -DETAIL: Select query cannot be pushed down to the worker. +$Q$); + coordinator_plan +--------------------------------------------------------------------- + Custom Scan (Citus INSERT ... SELECT) + INSERT/SELECT method: repartition + -> Custom Scan (Citus Adaptive) + -> Distributed Subplan XXX_1 + -> Custom Scan (Citus Adaptive) + Task Count: 4 +(6 rows) + SET citus.enable_cte_inlining TO true; -- Tests with foreign key to reference table CREATE TABLE test_ref_table (key int PRIMARY KEY); diff --git a/src/test/regress/sql/multi_insert_select_conflict.sql b/src/test/regress/sql/multi_insert_select_conflict.sql index 9e5e3cb34..cd0057fe0 100644 --- a/src/test/regress/sql/multi_insert_select_conflict.sql +++ b/src/test/regress/sql/multi_insert_select_conflict.sql @@ -153,8 +153,9 @@ UPDATE target_table SET col_2 = 4 WHERE col_1 IN (SELECT col_1 FROM cte); RESET client_min_messages; --- Following query is not supported since error checks of the subquery pushdown planner --- and insert select planner have not been unified. It should work after unifying them. +-- Following query is supported by using repartition join for the insert/select +SELECT coordinator_plan($Q$ +EXPLAIN (costs off) WITH cte AS ( SELECT col_1, col_2 @@ -167,6 +168,7 @@ SELECT source_table_1.col_2 FROM cte, source_table_1 WHERE cte.col_1 = source_table_1.col_1 ON CONFLICT DO NOTHING; +$Q$); SET citus.enable_cte_inlining TO true;