pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Euler Taveira <euler@eulerto.com>
To: Christoph Berg <myon@debian.org>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Inconsistent "ICU Locale" output on older server versions
Date: Fri, 15 Apr 2022 12:48:30 -0300
Message-ID: <a8dabdf4-1012-4c00-9d64-8e37f4ab4af5@www.fastmail.com> (raw)
In-Reply-To: <YlmIFCqu+TZSW4rB@msg.df7cb.de>
References: <E1nUnH5-0006aR-MX@gemulon.postgresql.org>
	<YjYYmsLr9mzqI4Jq@msg.df7cb.de>
	<YlmIFCqu+TZSW4rB@msg.df7cb.de>

On Fri, Apr 15, 2022, at 11:58 AM, Christoph Berg wrote:
> When running psql 15 against PG 14, the output is this:
> 
> $ psql -l
>                                                 List of databases
>    Name    │  Owner   │ Encoding │  Collate   │   Ctype    │ ICU Locale │ Locale Provider │   Access privileges
> ───────────┼──────────┼──────────┼────────────┼────────────┼────────────┼─────────────────┼───────────────────────
> postgres  │ postgres │ UTF8     │ de_DE.utf8 │ de_DE.utf8 │ de_DE.utf8 │ libc            │
> template0 │ postgres │ UTF8     │ de_DE.utf8 │ de_DE.utf8 │ de_DE.utf8 │ libc            │ =c/postgres          ↵
>            │          │          │            │            │            │                 │ postgres=CTc/postgres
> template1 │ postgres │ UTF8     │ de_DE.utf8 │ de_DE.utf8 │ de_DE.utf8 │ libc            │ =c/postgres          ↵
>            │          │          │            │            │            │                 │ postgres=CTc/postgres
> (3 rows)
> 
> The "ICU Locale" column is now populated, that seems wrong.
Good catch!

> The problem is in the else branch in src/bin/psql/describe.c around
> line 900:
> 
> +   if (pset.sversion >= 150000)
> +       appendPQExpBuffer(&buf,
> +                         "       d.daticulocale as \"%s\",\n"
> +                         "       CASE d.datlocprovider WHEN 'c' THEN 'libc' WHEN 'i' THEN 'icu' END AS \"%s\",\
> +                         gettext_noop("ICU Locale"),
> +                         gettext_noop("Locale Provider"));
> +   else
> +       appendPQExpBuffer(&buf,
> +                         "       d.datcollate as \"%s\",\n"  <--- there
> +                         "       'libc' AS \"%s\",\n",
> +                         gettext_noop("ICU Locale"),
> +                         gettext_noop("Locale Provider"));
> 
> I'd think this should rather be
> 
> +                         "       '' as \"%s\",\n"
Since dataiculocale allows NULL, my suggestion is to use NULL instead of an
empty string. It is consistent with a cluster whose locale provider is libc.


--
Euler Taveira
EDB   https://www.enterprisedb.com/

view thread (3+ messages)  latest in thread

Message-ID: <a8dabdf4-1012-4c00-9d64-8e37f4ab4af5@www.fastmail.com>
Permalink:  ../a8dabdf4-1012-4c00-9d64-8e37f4ab4af5@www.fastmail.com/
Also on:    postgresql.org/message-id/a8dabdf4-1012-4c00-9d64-8e37f4ab4af5@www.fastmail.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: euler@eulerto.com, myon@debian.org, peter@eisentraut.org, pgsql-hackers@lists.postgresql.org
  Subject: Re: Inconsistent "ICU Locale" output on older server versions
  In-Reply-To: <a8dabdf4-1012-4c00-9d64-8e37f4ab4af5@www.fastmail.com>
  References: <E1nUnH5-0006aR-MX@gemulon.postgresql.org> <YjYYmsLr9mzqI4Jq@msg.df7cb.de> <YlmIFCqu+TZSW4rB@msg.df7cb.de> <a8dabdf4-1012-4c00-9d64-8e37f4ab4af5@www.fastmail.com>

* 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