diff --git a/src/test/regress/expected/with_modifying.out b/src/test/regress/expected/with_modifying.out index ebff96bc8..064df3aa4 100644 --- a/src/test/regress/expected/with_modifying.out +++ b/src/test/regress/expected/with_modifying.out @@ -586,6 +586,24 @@ raw_data AS ( SELECT * FROM raw_data ORDER BY val; ERROR: cannot perform distributed planning for the given modification DETAIL: Recursively planned distributed modifications with ctid on where clause are not supported. +-- Needed becaues of CTE inlining triggering https://github.com/citusdata/citus/issues/3189 +SET citus.enable_cte_inlining TO FALSE; +WITH added_data AS ( + INSERT INTO modify_table VALUES (1, trunc(10 * random())), (1, trunc(random())) RETURNING * +), +select_data AS ( + SELECT val, now() FROM added_data WHERE id = 1 +), +raw_data AS ( + DELETE FROM modify_table WHERE id = 1 AND val IN (SELECT val FROM select_data) RETURNING * +) +SELECT COUNT(*) FROM raw_data; + count +--------------------------------------------------------------------- + 2 +(1 row) + +SET citus.enable_cte_inlining TO TRUE; WITH added_data AS ( INSERT INTO modify_table VALUES (1, trunc(10 * random())), (1, trunc(random())) RETURNING * ), diff --git a/src/test/regress/sql/with_modifying.sql b/src/test/regress/sql/with_modifying.sql index f01422c3f..f49d53be0 100644 --- a/src/test/regress/sql/with_modifying.sql +++ b/src/test/regress/sql/with_modifying.sql @@ -354,6 +354,20 @@ raw_data AS ( ) SELECT * FROM raw_data ORDER BY val; +-- Needed becaues of CTE inlining triggering https://github.com/citusdata/citus/issues/3189 +SET citus.enable_cte_inlining TO FALSE; +WITH added_data AS ( + INSERT INTO modify_table VALUES (1, trunc(10 * random())), (1, trunc(random())) RETURNING * +), +select_data AS ( + SELECT val, now() FROM added_data WHERE id = 1 +), +raw_data AS ( + DELETE FROM modify_table WHERE id = 1 AND val IN (SELECT val FROM select_data) RETURNING * +) +SELECT COUNT(*) FROM raw_data; +SET citus.enable_cte_inlining TO TRUE; + WITH added_data AS ( INSERT INTO modify_table VALUES (1, trunc(10 * random())), (1, trunc(random())) RETURNING * ),