pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Introduce "builtin" collation provider.
Date: Tue, 23 Apr 2024 11:23:35 +0200
Message-ID: <4ea13583-7305-40b0-8525-58381533e2b1@eisentraut.org> (raw)
In-Reply-To: <E1rkek5-003irT-3s@gemulon.postgresql.org>
References: <E1rkek5-003irT-3s@gemulon.postgresql.org>

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.






view thread (4+ messages)  latest in thread

Message-ID: <4ea13583-7305-40b0-8525-58381533e2b1@eisentraut.org>
Permalink:  ../4ea13583-7305-40b0-8525-58381533e2b1@eisentraut.org/
Also on:    postgresql.org/message-id/4ea13583-7305-40b0-8525-58381533e2b1@eisentraut.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Introduce "builtin" collation provider.
  In-Reply-To: <4ea13583-7305-40b0-8525-58381533e2b1@eisentraut.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox