Re: pgsql: Introduce "builtin" collation provider.

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Jeff Davis <jdavis(at)postgresql(dot)org>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Introduce "builtin" collation provider.
Date: 2024-04-23 09:23:35
Message-ID: 4ea13583-7305-40b0-8525-58381533e2b1@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 14.03.24 07:39, Jeff Davis wrote:
> Introduce "builtin" collation provider.

Jeff,

I think I found a small bug in this commit.

The new code in dbcommands.c createdb() reads like this:

+ /* validate provider-specific parameters */
+ if (dblocprovider != COLLPROVIDER_BUILTIN)
+ {
+ if (dbuiltinlocale)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("BUILTIN_LOCALE cannot be specified unless
locale provider is builtin")));
+ }
+ else if (dblocprovider != COLLPROVIDER_ICU)
+ {
+ if (diculocale)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("ICU locale cannot be specified unless
locale provider is ICU")));
+
+ if (dbicurules)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("ICU rules cannot be specified unless locale
provider is ICU")));
+ }

But if dblocprovider is COLLPROVIDER_LIBC, then the first "if" is true
and the second one won't be checked. I think the correct code structure
would be to make both of these checks separate if statements.

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2024-04-23 15:33:51 Re: pgsql: Introduce "builtin" collation provider.
Previous Message Amit Kapila 2024-04-23 07:09:35 pgsql: Fix the handling of the failover option in subscription commands

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2024-04-23 09:37:37 Re: query_id, pg_stat_activity, extended query protocol
Previous Message Tender Wang 2024-04-23 08:59:42 Re: Should consider materializing the cheapest inner path in consider_parallel_nestloop()