Re: insensitive collations
Daniel Verite <daniel@manitou-mail.org>
From: "Daniel Verite" <daniel@manitou-mail.org>
To: "Peter Eisentraut" <peter.eisentraut@2ndquadrant.com>
Cc: "pgsql-hackers" <pgsql-hackers@postgresql.org>
Date: 2019-01-14T12:23:53Z
Lists: pgsql-hackers
Peter Eisentraut wrote:
> Here is an updated patch.
On a table with pre-existing contents, the creation of a unique index
does not seem to detect the duplicates that are equal per the
collation and different binary-wise.
postgres=# \d test3ci
Table "public.test3ci"
Column | Type | Collation | Nullable | Default
--------+------+------------------+----------+---------
x | text | case_insensitive | |
postgres=# select * from test3ci;
x
-----
abc
ABC
def
ghi
(4 rows)
postgres=# create unique index idx on test3ci(x); -- EXPECTED TO FAIL
CREATE INDEX
postgres=# \d test3ci
Table "public.test3ci"
Column | Type | Collation | Nullable | Default
--------+------+------------------+----------+---------
x | text | case_insensitive | |
Indexes:
"idx" UNIQUE, btree (x)
postgres=# select count(*) from test3ci where x='abc';
count
-------
2
(1 row)
OTOH with an already existing unique index, attempts to insert
such duplicates are rejected as expected.
Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite
Commits
-
Collations with nondeterministic comparison
- 5e1963fb764e 12.0 landed
-
Add support for collation attributes on older ICU versions
- b8f9a2a69a27 12.0 landed
-
Make type "name" collation-aware.
- 586b98fdf1aa 12.0 cited
-
Make collation-aware system catalog columns use "C" collation.
- 6b0faf723647 12.0 cited
-
Adjust string comparison so that only bitwise-equal strings are considered
- 656beff59033 8.2.0 cited