From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | Daniel Verite <daniel(at)manitou-mail(dot)org> |
Cc: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Pgsql-Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Allow tailoring of ICU locales with custom rules |
Date: | 2023-02-04 20:46:16 |
Message-ID: | 74b9aedd8990cbb01982f3e86d5ae932b5b5aed8.camel@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, 2023-02-04 at 14:41 +0100, Daniel Verite wrote:
> Laurenz Albe wrote:
>
> > Cool so far. Now I created a database with that locale:
> >
> > CREATE DATABASE teutsch LOCALE_PROVIDER icu ICU_LOCALE german_phone
> > LOCALE "de_AT.utf8" TEMPLATE template0;
> >
> > Now the rules are not in "pg_database":
>
> The parameter after ICU_LOCALE is passed directly to ICU as a locale
> ID, as opposed to refering a collation name in the current database.
> This CREATE DATABASE doesn't fail because ICU accepts pretty much
> anything as a locale ID, ignoring what it can't parse instead of
> erroring out.
>
> I think the way to express what you want should be:
>
> CREATE DATABASE teutsch
> LOCALE_PROVIDER icu
> ICU_LOCALE 'de_AT'
> LOCALE 'de_AT.utf8'
> ICU_RULES '&a < g';
>
> However it still leaves "daticurules" empty in the destination db,
> because of an actual bug in the current patch.
I see. Thanks for the explanation.
> > I guess that it is not the fault of this patch that the collation
> > isn't there, but I think it is surprising. What good is a database
> > collation that does not exist in the database?
>
> Even if the above invocation of CREATE DATABASE worked as you
> intuitively expected, by getting the characteristics from the
> user-defined collation for the destination db, it still wouldn't work to
> refer
> to COLLATE "german_phone" in the destination database.
> That's because there would be no "german_phone" entry in the
> pg_collation of the destination db, as it's cloned from the template
> db, which has no reason to have this collation.
That makes sense. Then I think that the current behavior is buggy:
You should not be allowed to specify a collation that does not exist in
the template database. Otherwise you end up with something weird.
This is not the fault of this patch though.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Andrey Borodin | 2023-02-04 21:37:29 | Re: Amcheck verification of GiST and GIN |
Previous Message | Andrey Borodin | 2023-02-04 20:44:26 | Re: How to implement read operations for my own access method? |