From: Tom Lane <tgl@sss.pgh.pa.us>
To: andrewbille@gmail.com
Cc: pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Subject: Re: BUG #17170: Invalid collation created with provider icu and initdb' locale C
Date: Tue, 31 Aug 2021 12:34:05 -0400
Message-ID: <1689869.1630427645@sss.pgh.pa.us> (raw)
In-Reply-To: <17170-95845cf3f0a9c36d@postgresql.org>
References: <17170-95845cf3f0a9c36d@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> When using postgres built "--with-icu" I get an invalid collation with the
> following script:
> initdb -D db --locale=C
> createdb testdb
> psql testdb -c "CREATE COLLATION test (provider=icu,
> locale='en_US.utf8');"
> psql testdb -c "SELECT 'a' < 'b' COLLATE test;"
> ERROR: collation "test" for encoding "SQL_ASCII" does not exist
> LINE 1: SELECT 'a' < 'b' COLLATE test;
> ^
That error doesn't seem inappropriate; ICU collations don't work
in SQL_ASCII encoding.
> psql testdb -c "DROP COLLATION test;"
> ERROR: collation "test" for encoding "SQL_ASCII" does not exist
That, however, is a bit annoying. If you can create the collation
you should be able to drop it.
The immediate issue is that DROP COLLATION uses the same lookup
rule as other code paths, so it fails to see inapplicable
pg_collation entries at all. So one approach to a fix is to
relax its lookup rule. But I wonder if we should have prevented
the CREATE in the first place, instead.
Unfortunately, either approach is likely to still have some
edge-case odd behaviors :-(. This whole business of having the
database encoding be implicitly part of the lookup rule is just
prone to that.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, andrewbille@gmail.com, peter.eisentraut@enterprisedb.com
Subject: Re: BUG #17170: Invalid collation created with provider icu and initdb' locale C
In-Reply-To: <1689869.1630427645@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox