Re: Inconsistent "ICU Locale" output on older server versions

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: "Christoph Berg" <myon(at)debian(dot)org>, "Peter Eisentraut" <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Inconsistent "ICU Locale" output on older server versions
Date: 2022-04-15 15:48:30
Message-ID: a8dabdf4-1012-4c00-9d64-8e37f4ab4af5@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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/

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-04-15 16:47:42 Re: Inconsistent "ICU Locale" output on older server versions
Previous Message Christoph Berg 2022-04-15 14:58:28 Inconsistent "ICU Locale" output on older server versions

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-04-15 16:16:40 Re: Intermittent buildfarm failures on wrasse
Previous Message Tom Lane 2022-04-15 15:23:40 Re: Intermittent buildfarm failures on wrasse