Skip to content

Commit 7ac0f8d

Browse files
committed
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
1 parent 4c689a6 commit 7ac0f8d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/utils/adt/varchar.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ hashbpcharextended(PG_FUNCTION_ARGS)
10861086
Size bsize;
10871087
uint8_t *buf;
10881088

1089-
ulen = icu_to_uchar(&uchar, VARDATA_ANY(key), VARSIZE_ANY_EXHDR(key));
1089+
ulen = icu_to_uchar(&uchar, keydata, keylen);
10901090

10911091
bsize = ucol_getSortKey(mylocale->info.icu.ucol,
10921092
uchar, ulen, NULL, 0);

0 commit comments

Comments
 (0)