Re: pgsql: Introduce "builtin" collation provider. - Mailing list pgsql-committers

From Peter Eisentraut
Subject Re: pgsql: Introduce "builtin" collation provider.
Date
Msg-id 4ea13583-7305-40b0-8525-58381533e2b1@eisentraut.org
Whole thread Raw
In response to pgsql: Introduce "builtin" collation provider.  (Jeff Davis <jdavis@postgresql.org>)
Responses Re: pgsql: Introduce "builtin" collation provider.
List pgsql-committers
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.




pgsql-committers by date:

Previous
From: Amit Kapila
Date:
Subject: pgsql: Fix the handling of the failover option in subscription commands
Next
From: Tom Lane
Date:
Subject: pgsql: Improve "out of range" error messages for GUCs.