diff options
author | Jeff Davis | 2022-12-01 19:08:47 +0000 |
---|---|---|
committer | Jeff Davis | 2022-12-02 22:06:31 +0000 |
commit | 7ac0f8d384a4633c6652ae1f6bba40d42d21ec18 (patch) | |
tree | ef6af09d8736e17eb4fdd32b6d3e0ca64ef8eacd | |
parent | 4c689a69eef639caa881539ee546ff1a5b11f98f (diff) |
Fix broken hash function hashbpcharextended().
Ignore trailing spaces for non-deterministic collations when
hashing.
The previous behavior could lead to tuples falling into the wrong
partitions when hash partitioning is combined with the BPCHAR type and
a non-deterministic collation. Fortunately, it did not affect hash
indexes, because hash indexes do not use extended hash functions.
Decline to backpatch, per discussion.
Discussion: https://postgr.es/m/[email protected]
Reviewed-by: Richard Guo, Tom Lane
-rw-r--r-- | src/backend/utils/adt/varchar.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c index 09c483d6ff..a63c498181 100644 --- a/src/backend/utils/adt/varchar.c +++ b/src/backend/utils/adt/varchar.c @@ -1086,7 +1086,7 @@ hashbpcharextended(PG_FUNCTION_ARGS) Size bsize; uint8_t *buf; - ulen = icu_to_uchar(&uchar, VARDATA_ANY(key), VARSIZE_ANY_EXHDR(key)); + ulen = icu_to_uchar(&uchar, keydata, keylen); bsize = ucol_getSortKey(mylocale->info.icu.ucol, uchar, ulen, NULL, 0); |