mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
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
This commit is contained in:
parent
73797b7884
commit
2af28e6033
@ -1891,7 +1891,7 @@ find_partition_scheme(PlannerInfo *root, Relation relation)
|
|||||||
sizeof(Oid) * partnatts) != 0 ||
|
sizeof(Oid) * partnatts) != 0 ||
|
||||||
memcmp(partkey->partopcintype, part_scheme->partopcintype,
|
memcmp(partkey->partopcintype, part_scheme->partopcintype,
|
||||||
sizeof(Oid) * partnatts) != 0 ||
|
sizeof(Oid) * partnatts) != 0 ||
|
||||||
memcmp(partkey->parttypcoll, part_scheme->parttypcoll,
|
memcmp(partkey->partcollation, part_scheme->partcollation,
|
||||||
sizeof(Oid) * partnatts) != 0)
|
sizeof(Oid) * partnatts) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -1926,8 +1926,8 @@ find_partition_scheme(PlannerInfo *root, Relation relation)
|
|||||||
memcpy(part_scheme->partopcintype, partkey->partopcintype,
|
memcpy(part_scheme->partopcintype, partkey->partopcintype,
|
||||||
sizeof(Oid) * partnatts);
|
sizeof(Oid) * partnatts);
|
||||||
|
|
||||||
part_scheme->parttypcoll = (Oid *) palloc(sizeof(Oid) * partnatts);
|
part_scheme->partcollation = (Oid *) palloc(sizeof(Oid) * partnatts);
|
||||||
memcpy(part_scheme->parttypcoll, partkey->parttypcoll,
|
memcpy(part_scheme->partcollation, partkey->partcollation,
|
||||||
sizeof(Oid) * partnatts);
|
sizeof(Oid) * partnatts);
|
||||||
|
|
||||||
part_scheme->parttyplen = (int16 *) palloc(sizeof(int16) * partnatts);
|
part_scheme->parttyplen = (int16 *) palloc(sizeof(int16) * partnatts);
|
||||||
|
@ -351,7 +351,7 @@ typedef struct PartitionSchemeData
|
|||||||
int16 partnatts; /* number of partition attributes */
|
int16 partnatts; /* number of partition attributes */
|
||||||
Oid *partopfamily; /* OIDs of operator families */
|
Oid *partopfamily; /* OIDs of operator families */
|
||||||
Oid *partopcintype; /* OIDs of opclass declared input data types */
|
Oid *partopcintype; /* OIDs of opclass declared input data types */
|
||||||
Oid *parttypcoll; /* OIDs of collations of partition keys. */
|
Oid *partcollation; /* OIDs of partitioning collations */
|
||||||
|
|
||||||
/* Cached information about partition key data types. */
|
/* Cached information about partition key data types. */
|
||||||
int16 *parttyplen;
|
int16 *parttyplen;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user