From 2af28e603319224e87fd35ab62f36ef6de45eaac Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Wed, 28 Feb 2018 12:16:09 -0500 Subject: For partitionwise join, match on partcollation, not parttypcoll. The previous code considered two tables to have the partition scheme if the underlying columns had the same collation, but what we actually need to compare is not the collations associated with the column but the collation used for partitioning. Fix that. Robert Haas and Amit Langote Discussion: http://postgr.es/m/0f95f924-0efa-4cf5-eb5f-9a3d1bc3c33d@lab.ntt.co.jp --- src/backend/optimizer/util/plancat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/backend/optimizer/util/plancat.c') diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index 60f21711f4f..b799e249db8 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -1891,7 +1891,7 @@ find_partition_scheme(PlannerInfo *root, Relation relation) sizeof(Oid) * partnatts) != 0 || memcmp(partkey->partopcintype, part_scheme->partopcintype, sizeof(Oid) * partnatts) != 0 || - memcmp(partkey->parttypcoll, part_scheme->parttypcoll, + memcmp(partkey->partcollation, part_scheme->partcollation, sizeof(Oid) * partnatts) != 0) continue; @@ -1926,8 +1926,8 @@ find_partition_scheme(PlannerInfo *root, Relation relation) memcpy(part_scheme->partopcintype, partkey->partopcintype, sizeof(Oid) * partnatts); - part_scheme->parttypcoll = (Oid *) palloc(sizeof(Oid) * partnatts); - memcpy(part_scheme->parttypcoll, partkey->parttypcoll, + part_scheme->partcollation = (Oid *) palloc(sizeof(Oid) * partnatts); + memcpy(part_scheme->partcollation, partkey->partcollation, sizeof(Oid) * partnatts); part_scheme->parttyplen = (int16 *) palloc(sizeof(int16) * partnatts); -- cgit v1.2.3