diff --git a/src/test/regress/expected/partition_join.out b/src/test/regress/expected/partition_join.out index 4fccd9ae54..6323a13777 100644 --- a/src/test/regress/expected/partition_join.out +++ b/src/test/regress/expected/partition_join.out @@ -1869,3 +1869,31 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_n t1 FULL JOIN prt1 t2 ON (t1.c = t2.c); -> Seq Scan on prt1_n_p2 t1_1 (10 rows) +-- +-- No partition-wise join if partitioning collation doesn't match +-- +CREATE TABLE posix_text (a text) PARTITION BY RANGE (a COLLATE "POSIX"); +CREATE TABLE posix_text1 PARTITION OF posix_text FOR VALUES FROM ('a') TO ('m'); +CREATE TABLE posix_text2 PARTITION OF posix_text FOR VALUES FROM ('m') TO ('z '); +CREATE TABLE c_text (a text) PARTITION BY RANGE (a COLLATE "C"); +CREATE TABLE c_text1 PARTITION OF c_text FOR VALUES FROM ('a') TO ('m'); +CREATE TABLE c_text2 PARTITION OF c_text FOR VALUES FROM ('m') TO ('z '); +EXPLAIN (COSTS OFF) +SELECT * FROM posix_text p JOIN c_text c ON (p.a = c.a); + QUERY PLAN +----------------------------------------------- + Merge Join + Merge Cond: (p.a = c.a) + -> Sort + Sort Key: p.a + -> Append + -> Seq Scan on posix_text1 p + -> Seq Scan on posix_text2 p_1 + -> Sort + Sort Key: c.a + -> Append + -> Seq Scan on c_text1 c + -> Seq Scan on c_text2 c_1 +(12 rows) + +DROP TABLE posix_text, c_text; diff --git a/src/test/regress/sql/partition_join.sql b/src/test/regress/sql/partition_join.sql index a2d8b1be55..0df7df487d 100644 --- a/src/test/regress/sql/partition_join.sql +++ b/src/test/regress/sql/partition_join.sql @@ -384,3 +384,19 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_n t1 JOIN prt2_n t2 ON (t1.c = t2.c) JOI -- partitioned table EXPLAIN (COSTS OFF) SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_n t1 FULL JOIN prt1 t2 ON (t1.c = t2.c); + +-- +-- No partition-wise join if partitioning collation doesn't match +-- +CREATE TABLE posix_text (a text) PARTITION BY RANGE (a COLLATE "POSIX"); +CREATE TABLE posix_text1 PARTITION OF posix_text FOR VALUES FROM ('a') TO ('m'); +CREATE TABLE posix_text2 PARTITION OF posix_text FOR VALUES FROM ('m') TO ('z '); + +CREATE TABLE c_text (a text) PARTITION BY RANGE (a COLLATE "C"); +CREATE TABLE c_text1 PARTITION OF c_text FOR VALUES FROM ('a') TO ('m'); +CREATE TABLE c_text2 PARTITION OF c_text FOR VALUES FROM ('m') TO ('z '); + +EXPLAIN (COSTS OFF) +SELECT * FROM posix_text p JOIN c_text c ON (p.a = c.a); + +DROP TABLE posix_text, c_text;