Re: pgsql: Introduce "builtin" collation provider.
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: Jeff Davis <jdavis@postgresql.org>, pgsql-committers@lists.postgresql.org
Date: 2024-04-23T09:23:35Z
Lists: 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.
Commits
-
Fix locale options checking in CREATE DATABASE.
- 7562a9bd7100 17.0 landed
-
Introduce "builtin" collation provider.
- 2d819a08a1cb 17.0 cited