BUG #19830: Mention that UNIQUE on a nondeterministic ICU collation treats ignorable characters as duplicates
BUG #19830: Mention that UNIQUE on a nondeterministic ICU collation treats ignorable characters as duplicates
От:
PG Bug reporting form <noreply@postgresql.org>
Дата:
The following bug has been logged on the website: Bug reference: 19830 Logged by: aswini kumar tummala Email address: aswin.tummala@gmail.com PostgreSQL version: 19rc1 Operating system: Windows, MacOs Description: Hi, When migrating from SQL Server, we found that a UNIQUE constraint on a column with und-u-ks-level2 (deterministic = false) rejects 'ACME' || U&'\200B' as a duplicate of 'ACME'. The same data loads fine into a citext column. Section 23.2.3.1 does show U+2063 being ignored, but it doesn't say what that means for constraints. A short note under "Nondeterministic Collations" would have saved us time. It could say that ignorable code points (zero-width space, soft hyphen, BOM, most control characters) don't count toward uniqueness, and that this differs from citext. Reproduced on 18.6 and 19 RC1. Thanks, Aswini Kumar Tummala
Re: BUG #19830: Mention that UNIQUE on a nondeterministic ICU collation treats ignorable characters as duplicates
От:
Peter Eisentraut <peter@eisentraut.org>
Дата:
On 04.11.26 02:43, PG Bug reporting form wrote: > When migrating from SQL Server, we found that a UNIQUE constraint on a > column with und-u-ks-level2 (deterministic = false) > rejects 'ACME' || U&'\200B' as a duplicate of 'ACME'. The same data loads > fine into a citext column. Section 23.2.3.1 does show > U+2063 being ignored, but it doesn't say what that means for constraints. > A short note under "Nondeterministic Collations" would > have saved us time. It could say that ignorable code points (zero-width > space, soft hyphen, BOM, most control characters) don't > count toward uniqueness, and that this differs from citext. What you are observing is a very specific combination of several features. It would be extremely niche and redundant to document this particular case. I would think that if you understand what nondeterministic collations are (and you have chosen to use them) and you know what unique constraints are, then this behavior would follow from that. We could perhaps try to clarify this somehow, but it would have to be in more general terms.