From 872789ea013a19e3adb7cbd602805c0a60d0b539 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Jun 2026 18:51:03 +0000 Subject: [PATCH 1/3] Initial plan From 0da8bd98983dc5a70668f5beedf187f17f999da6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Jun 2026 18:58:38 +0000 Subject: [PATCH 2/3] Normalize relation name order in "are not colocated" error detail to fix flaky tests --- src/test/regress/bin/normalize.sed | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/regress/bin/normalize.sed b/src/test/regress/bin/normalize.sed index c470d6cf049..95a4466fded 100644 --- a/src/test/regress/bin/normalize.sed +++ b/src/test/regress/bin/normalize.sed @@ -388,3 +388,11 @@ s/^[[:space:]]*ERROR:[[:space:]]+could not connect to the publisher:[[:space:]]* # can be removed when dropping pg17 support s/(:varnullingrels \(b\) :varlevelsup 0) (:varnosyn 1)/\1 :varreturningtype 0 \2/g # end pg18 varreturningtype + +# The two relation names in the " and are not colocated" error detail +# can be printed in either order depending on the Citus version that produced +# the message. Citus #8319 made newer versions print the names in sorted order, +# but older versions (and therefore mixed-version regression runs) still print +# them in a nondeterministic order. Normalize both names so the order of the +# two relations never causes spurious diffs. See issue #8275. +s/^DETAIL: [a-zA-Z0-9_]+ and [a-zA-Z0-9_]+ are not colocated$/DETAIL: and are not colocated/ From 6540f0340db6c31b195844bcf29cc4df6740aa46 Mon Sep 17 00:00:00 2001 From: Ibrahim Halatci Date: Sat, 13 Jun 2026 21:15:01 +0300 Subject: [PATCH 3/3] Normalize expected outputs for "are not colocated" detail rule Run ci/normalize_expected.sh so the committed expected .out files match the new normalize.sed rule that collapses the two relation names in the "DETAIL: X and Y are not colocated" message to placeholders. Fixes the failing check-style step (ci/normalize_expected.sh && git diff --exit-code). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../insert_select_single_shard_table.out | 4 ++-- src/test/regress/expected/join_pushdown.out | 2 +- .../regress/expected/multi_modifications.out | 2 +- .../expected/multi_shard_update_delete.out | 2 +- .../expected/query_single_shard_table.out | 24 +++++++++---------- .../expected/recurring_join_pushdown.out | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/test/regress/expected/insert_select_single_shard_table.out b/src/test/regress/expected/insert_select_single_shard_table.out index 4a66dd64a4b..8a1a31e0f31 100644 --- a/src/test/regress/expected/insert_select_single_shard_table.out +++ b/src/test/regress/expected/insert_select_single_shard_table.out @@ -182,7 +182,7 @@ DEBUG: cannot perform distributed INSERT INTO ... SELECT because the partition DETAIL: The target table's partition column should correspond to a partition column in the subquery. DEBUG: router planner does not support queries that reference non-colocated distributed tables ERROR: cannot push down this subquery -DETAIL: nullkey_c1_t2 and nullkey_c2_t1 are not colocated +DETAIL: and are not colocated INSERT INTO distributed_table_c1_t1 SELECT * FROM nullkey_c1_t1 UNION SELECT * FROM nullkey_c2_t1; DEBUG: cannot perform distributed INSERT INTO ... SELECT because the partition columns in the source table and subquery do not match DETAIL: The target table's partition column should correspond to a partition column in the subquery. @@ -315,7 +315,7 @@ INSERT INTO reference_table SELECT nullkey_c1_t2.a, nullkey_c1_t2.b FROM nullkey DEBUG: only reference tables may be queried when targeting a reference table with distributed INSERT ... SELECT DEBUG: router planner does not support queries that reference non-colocated distributed tables ERROR: cannot push down this subquery -DETAIL: nullkey_c1_t2 and nullkey_c2_t1 are not colocated +DETAIL: and are not colocated -- use a distributed table SET client_min_messages TO DEBUG1; SET citus.enable_repartition_joins TO ON; diff --git a/src/test/regress/expected/join_pushdown.out b/src/test/regress/expected/join_pushdown.out index 004c007ef56..c42e66d2352 100644 --- a/src/test/regress/expected/join_pushdown.out +++ b/src/test/regress/expected/join_pushdown.out @@ -152,7 +152,7 @@ ORDER BY 1; -- Full outer join with different distribution column types, should error out SELECT * FROM test_table_1 full join test_table_2 using(id); ERROR: cannot push down this subquery -DETAIL: test_table_1 and test_table_2 are not colocated +DETAIL: and are not colocated -- Test when the non-distributed column has the value of NULL INSERT INTO test_table_1 VALUES(7, NULL); INSERT INTO test_table_2 VALUES(7, NULL); diff --git a/src/test/regress/expected/multi_modifications.out b/src/test/regress/expected/multi_modifications.out index f8b555b3f0a..2d81cdc0c08 100644 --- a/src/test/regress/expected/multi_modifications.out +++ b/src/test/regress/expected/multi_modifications.out @@ -552,7 +552,7 @@ ERROR: complex joins are only supported when all distributed tables are co-loca -- setting shard key to another var that's implied to be equal to shard key -- UPDATE dist_1 SET a = dist_non_colocated.a FROM dist_non_colocated WHERE dist_1.a = dist_non_colocated.a; ERROR: cannot push down this subquery -DETAIL: dist_1 and dist_non_colocated are not colocated +DETAIL: and are not colocated UPDATE dist_1 SET a = dist_2.b FROM dist_2 WHERE dist_1.a = dist_2.b; ERROR: complex joins are only supported when all distributed tables are co-located and joined on their distribution columns ---- update: a more sophisticated example ---- diff --git a/src/test/regress/expected/multi_shard_update_delete.out b/src/test/regress/expected/multi_shard_update_delete.out index 55f8139f1d5..969aab187b2 100644 --- a/src/test/regress/expected/multi_shard_update_delete.out +++ b/src/test/regress/expected/multi_shard_update_delete.out @@ -725,7 +725,7 @@ SET value_2 = 5 FROM events_test_table_2 WHERE users_test_table.user_id = events_test_table_2.user_id; ERROR: cannot push down this subquery -DETAIL: events_test_table_2 and users_test_table are not colocated +DETAIL: and are not colocated -- Should error out due to multiple row return from subquery, but we can not get this information within -- subquery pushdown planner. This query will be sent to worker with recursive planner. \set VERBOSITY terse diff --git a/src/test/regress/expected/query_single_shard_table.out b/src/test/regress/expected/query_single_shard_table.out index 1b3b0f753d7..1418d5f388a 100644 --- a/src/test/regress/expected/query_single_shard_table.out +++ b/src/test/regress/expected/query_single_shard_table.out @@ -522,12 +522,12 @@ SELECT * FROM nullkey_c1_t1 LEFT JOIN nullkey_c2_t2 USING(a) ORDER BY 1,2,3 LIMI DEBUG: router planner does not support queries that reference non-colocated distributed tables DEBUG: push down of limit count: 4 ERROR: cannot push down this subquery -DETAIL: nullkey_c1_t1 and nullkey_c2_t2 are not colocated +DETAIL: and are not colocated SELECT * FROM nullkey_c1_t1 FULL JOIN nullkey_c2_t2 USING(a) ORDER BY 1,2,3 LIMIT 4; DEBUG: router planner does not support queries that reference non-colocated distributed tables DEBUG: push down of limit count: 4 ERROR: cannot push down this subquery -DETAIL: nullkey_c1_t1 and nullkey_c2_t2 are not colocated +DETAIL: and are not colocated SELECT * FROM nullkey_c1_t1 t1 LEFT JOIN LATERAL ( SELECT * FROM nullkey_c2_t2 t2 WHERE t2.b > t1.a @@ -535,35 +535,35 @@ LEFT JOIN LATERAL ( DEBUG: router planner does not support queries that reference non-colocated distributed tables DEBUG: push down of limit count: 7 ERROR: cannot push down this subquery -DETAIL: nullkey_c1_t1 and nullkey_c2_t2 are not colocated +DETAIL: and are not colocated SELECT COUNT(*) FROM nullkey_c1_t1 t1 LEFT JOIN LATERAL ( SELECT * FROM nullkey_c2_t2 t2 WHERE t2.b > t1.a ) q USING(a); DEBUG: router planner does not support queries that reference non-colocated distributed tables ERROR: cannot push down this subquery -DETAIL: nullkey_c1_t1 and nullkey_c2_t2 are not colocated +DETAIL: and are not colocated SELECT COUNT(*) FROM nullkey_c1_t1 t1 WHERE EXISTS ( SELECT * FROM nullkey_c2_t2 t2 WHERE t2.b > t1.a ); DEBUG: router planner does not support queries that reference non-colocated distributed tables ERROR: cannot push down this subquery -DETAIL: nullkey_c1_t1 and nullkey_c2_t2 are not colocated +DETAIL: and are not colocated SELECT COUNT(*) FROM nullkey_c1_t1 t1 WHERE t1.b IN ( SELECT b+1 FROM nullkey_c2_t2 t2 WHERE t2.b = t1.a ); DEBUG: router planner does not support queries that reference non-colocated distributed tables ERROR: cannot push down this subquery -DETAIL: nullkey_c1_t1 and nullkey_c2_t2 are not colocated +DETAIL: and are not colocated SELECT COUNT(*) FROM nullkey_c1_t1 t1 WHERE t1.b NOT IN ( SELECT a FROM nullkey_c2_t2 t2 WHERE t2.b > t1.a ); DEBUG: router planner does not support queries that reference non-colocated distributed tables ERROR: cannot push down this subquery -DETAIL: nullkey_c1_t1 and nullkey_c2_t2 are not colocated +DETAIL: and are not colocated -- join with a reference table SELECT COUNT(*) FROM nullkey_c1_t1, reference_table WHERE nullkey_c1_t1.a = reference_table.a; DEBUG: Creating router plan @@ -3009,14 +3009,14 @@ ORDER BY 1,2 LIMIT 1; DEBUG: router planner does not support queries that reference non-colocated distributed tables DEBUG: push down of limit count: 1 ERROR: cannot push down this subquery -DETAIL: non_colocated_events_table and users_table are not colocated +DETAIL: and are not colocated SELECT event_type, (SELECT max(time) FROM users_table WHERE user_id = e.value_2) FROM non_colocated_events_table e ORDER BY 1,2 LIMIT 1; DEBUG: router planner does not support queries that reference non-colocated distributed tables DEBUG: push down of limit count: 1 ERROR: cannot push down this subquery -DETAIL: non_colocated_events_table and users_table are not colocated +DETAIL: and are not colocated SELECT event_type, (SELECT max(time) FROM users_table) FROM non_colocated_events_table e ORDER BY 1,2 LIMIT 1; @@ -3118,7 +3118,7 @@ ORDER BY 1 LIMIT 3; DEBUG: router planner does not support queries that reference non-colocated distributed tables DEBUG: push down of limit count: 3 ERROR: cannot push down this subquery -DETAIL: non_colocated_events_table and users_table are not colocated +DETAIL: and are not colocated SELECT (SELECT (SELECT e.user_id + user_id) FROM users_reference_table WHERE user_id = e.user_id GROUP BY user_id) FROM non_colocated_events_table e GROUP BY 1 @@ -3169,7 +3169,7 @@ ORDER BY 1 LIMIT 3; DEBUG: router planner does not support queries that reference non-colocated distributed tables DEBUG: push down of limit count: 3 ERROR: cannot push down this subquery -DETAIL: non_colocated_events_table and users_table are not colocated +DETAIL: and are not colocated SELECT user_id, count(*) FROM @@ -3295,7 +3295,7 @@ DEBUG: generating subplan XXX_1 for subquery SELECT a FROM query_single_shard_t DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count, avg(a) AS avg FROM (SELECT table_0.a FROM (query_single_shard_table.nullkey_c1_t1 table_0 RIGHT JOIN (SELECT table_2.a FROM ((SELECT intermediate_result.a FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(a integer)) table_2 JOIN query_single_shard_table.nullkey_c2_t1 table_4 USING (a)) WHERE (table_4.a OPERATOR(pg_catalog.<) 8)) table_1 USING (a))) avgsub DEBUG: router planner does not support queries that reference non-colocated distributed tables ERROR: cannot push down this subquery -DETAIL: nullkey_c1_t1 and nullkey_c2_t1 are not colocated +DETAIL: and are not colocated -- test nested exec CREATE FUNCTION dist_query_single_shard(p_key int) RETURNS bigint diff --git a/src/test/regress/expected/recurring_join_pushdown.out b/src/test/regress/expected/recurring_join_pushdown.out index e452b6410fa..6e9b8cd04dc 100644 --- a/src/test/regress/expected/recurring_join_pushdown.out +++ b/src/test/regress/expected/recurring_join_pushdown.out @@ -121,11 +121,11 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS c -- Test that the join is not pushed down when we have non-colocated tables in the RHS SELECT count(*) FROM r1 LEFT JOIN (SELECT d1.a, d3_not_colocated.b FROM d3_not_colocated FULL JOIN d1 ON d3_not_colocated.a = d1.a) AS t1 USING (a); ERROR: cannot push down this subquery -DETAIL: d1 and d3_not_colocated are not colocated +DETAIL: and are not colocated -- The same error with its RIGHT JOIN variant SELECT count(*) FROM r1 LEFT JOIN (SELECT d1.a, d3_not_colocated.b FROM d3_not_colocated JOIN d1 ON d3_not_colocated.a = d1.a) AS t1 USING (a); ERROR: cannot push down this subquery -DETAIL: d1 and d3_not_colocated are not colocated +DETAIL: and are not colocated -- Basic test cases with ON syntax -- Test that the join is pushed down to the worker nodes, using "on" syntax SET client_min_messages TO DEBUG3;