Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2af28e6

Browse files
committed
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
1 parent 73797b7 commit 2af28e6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/backend/optimizer/util/plancat.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,7 @@ find_partition_scheme(PlannerInfo *root, Relation relation)
18911891
sizeof(Oid) * partnatts) != 0 ||
18921892
memcmp(partkey->partopcintype, part_scheme->partopcintype,
18931893
sizeof(Oid) * partnatts) != 0 ||
1894-
memcmp(partkey->parttypcoll, part_scheme->parttypcoll,
1894+
memcmp(partkey->partcollation, part_scheme->partcollation,
18951895
sizeof(Oid) * partnatts) != 0)
18961896
continue;
18971897

@@ -1926,8 +1926,8 @@ find_partition_scheme(PlannerInfo *root, Relation relation)
19261926
memcpy(part_scheme->partopcintype, partkey->partopcintype,
19271927
sizeof(Oid) * partnatts);
19281928

1929-
part_scheme->parttypcoll = (Oid *) palloc(sizeof(Oid) * partnatts);
1930-
memcpy(part_scheme->parttypcoll, partkey->parttypcoll,
1929+
part_scheme->partcollation = (Oid *) palloc(sizeof(Oid) * partnatts);
1930+
memcpy(part_scheme->partcollation, partkey->partcollation,
19311931
sizeof(Oid) * partnatts);
19321932

19331933
part_scheme->parttyplen = (int16 *) palloc(sizeof(int16) * partnatts);

src/include/nodes/relation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ typedef struct PartitionSchemeData
351351
int16 partnatts; /* number of partition attributes */
352352
Oid *partopfamily; /* OIDs of operator families */
353353
Oid *partopcintype; /* OIDs of opclass declared input data types */
354-
Oid *parttypcoll; /* OIDs of collations of partition keys. */
354+
Oid *partcollation; /* OIDs of partitioning collations */
355355

356356
/* Cached information about partition key data types. */
357357
int16 *parttyplen;

0 commit comments

Comments
 (0)