hashing bpchar for nondeterministic collations is broken - Mailing list pgsql-bugs

From Jeff Davis
Subject hashing bpchar for nondeterministic collations is broken
Date
Msg-id eb83d0ac7b299eb08f9b900dd08a5a0c5d90e517.camel@j-davis.com
Whole thread Raw
Responses Re: hashing bpchar for nondeterministic collations is broken
Re: hashing bpchar for nondeterministic collations is broken
List pgsql-bugs
CREATE COLLATION ctest_nondet(
  provider = icu, locale = '', deterministic = false);

=# select hashbpcharextended('a' collate ctest_nondet, 3);
 hashbpcharextended
---------------------
 2792701603979490504
(1 row)

=# select hashbpcharextended('a  ' collate ctest_nondet, 3);
  hashbpcharextended
----------------------
 -4885217598372536483
(1 row)


I don't see any major consequences, because in both hash indexes and
partitioning it appears that the trailing spaces on the key are already
gone before hashbpcharextended is called. If someone does see bigger
consequences here, please let me know.

Seems to be an oversight. Patch attached.

Also, does someone have an opinion on backporting this? I'm inclined
to.


--
Jeff Davis
PostgreSQL Contributor Team - AWS



Attachment

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_catalog.pg_get_viewdef pretty-print removes important parentheses
Next
From: "David G. Johnston"
Date:
Subject: Re: Bug in jsonb_path_exists (maybe _match) one-element scalar/variable jsonpath handling