Re: ICU for global collation

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Daniel Verite <daniel(at)manitou-mail(dot)org>
Subject: Re: ICU for global collation
Date: 2022-03-10 09:52:41
Message-ID: 29ae752f-80e9-8d31-601c-62cf01cc93d8@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 05.03.22 09:38, Julien Rouhaud wrote:
> @@ -168,18 +175,6 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
> errmsg("collation \"default\" cannot be copied")));
> }
>
> - if (localeEl)
> - {
> - collcollate = defGetString(localeEl);
> - collctype = defGetString(localeEl);
> - }
> [...]
>
> I tried to read the function and quickly got confused about whether possible
> problematic conditions could be reached or not and had protection or not. I
> think that DefineCollation is becoming more and more unreadable, with a mix of
> fromEl, !fromEl and either. Maybe it would be a good time to refactor the code
> a bit and have have something like
>
> if (fromEl)
> {
> // initialize all specific things
> }
> else
> {
> // initialize all specific things
> }
>
> // handle defaults and sanity checks
>
> What do you think?

How about the attached?

Attachment Content-Type Size
0001-DefineCollation-code-cleanup.patch text/plain 4.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2022-03-10 10:27:12 Re: ICU for global collation
Previous Message Nikita Malakhov 2022-03-10 08:47:32 Re: Pluggable toaster