Re: BUG #17170: Invalid collation created with provider icu and initdb' locale C

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: andrewbille(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17170: Invalid collation created with provider icu and initdb' locale C
Date: 2021-08-31 20:10:53
Message-ID: 2020287.1630440653@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> 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.

After a bit of experimentation, I'm inclined to the idea that
we should have rejected the CREATE COLLATION in the first place.
It's not very useful to create a collation that you're not going
to be able to use, and I think it's more user-friendly to say so
up front than to leave the user guessing about why subsequent
references don't work.

There is arguably one use-case that this fix shuts off: manually
adding ICU-based collations to template0, in the expectation
that they could get cloned into other databases where they'd be
useful. But that seems like a mighty thin argument, especially
since you could initdb with an ICU-compatible encoding if you
want to do that.

regards, tom lane

Attachment Content-Type Size
prevent-creating-useless-ICU-collations.patch text/x-diff 935 bytes

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-08-31 20:43:54 Re: BUG #17158: Distinct ROW fails with Postgres 14
Previous Message Tom Lane 2021-08-31 16:34:05 Re: BUG #17170: Invalid collation created with provider icu and initdb' locale C