Re: [HACKERS] CREATE COLLATION does not sanitize ICU's BCP 47language tags. Should it? - Mailing list pgsql-hackers

From Andreas Karlsson
Subject Re: [HACKERS] CREATE COLLATION does not sanitize ICU's BCP 47language tags. Should it?
Date
Msg-id 7824354d-cefe-8cc7-01c5-6812e7611eb5@proxel.se
Whole thread Raw
In response to [HACKERS] CREATE COLLATION does not sanitize ICU's BCP 47 language tags. Should it?  (Peter Geoghegan <pg@bowt.ie>)
Responses Re: [HACKERS] CREATE COLLATION does not sanitize ICU's BCP 47 language tags. Should it?
List pgsql-hackers
On 09/19/2017 12:46 AM, Peter Geoghegan wrote:> At one point a couple of 
months back, it was understood that
> get_icu_language_tag() might not always work with (assumed) valid
> locale names -- that is at least the impression that the commit
> message of eccead9 left me with. But, that was only with ICU 4.2, and
> in any case we've since stopped creating keyword variants at initdb
> time for other reasons (see 2bfd1b1 for details of those other
> reasons). I tend to think that we should not install any language tag
> that uloc_toLanguageTag() does not accept as valid on general
> principle (so not just at initdb time, when it's actually least
> needed).
> 
> Thoughts? I can write a patch for this, if that helps. It should be
> straightforward.

Hm, I like the idea but I see some issues.

Enforcing the BCP47 seems like a good thing to me. I do not see any 
reason to allow input with syntax errors. The issue though is that we do 
not want to break people's databases when they upgrade to PostgreSQL 11. 
What if they have specified the locale in the old non-ICU format or they 
have a bogus value and we then error out on pg_upgrade or pg_restore?

Andreas


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: [HACKERS] src/test/subscription/t/002_types.pl hanging onparticular environment
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] src/test/subscription/t/002_types.pl hanging on particular environment