| From: | Christoph Berg <myon(at)debian(dot)org> | 
|---|---|
| To: | Peter Eisentraut <peter(at)eisentraut(dot)org> | 
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org | 
| Subject: | Inconsistent "ICU Locale" output on older server versions | 
| Date: | 2022-04-15 14:58:28 | 
| Message-ID: | YlmIFCqu+TZSW4rB@msg.df7cb.de | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-committers pgsql-hackers | 
Re: To Peter Eisentraut
> This hardly fits in normal-size terminals:
> 
> =# \l
>                                              List of databases
>    Name    │ Owner │ Encoding │  Collate   │   Ctype    │ ICU Locale │ Locale Provider │ Access privileges
> ───────────┼───────┼──────────┼────────────┼────────────┼────────────┼─────────────────┼───────────────────
>  postgres  │ myon  │ UTF8     │ de_DE.utf8 │ de_DE.utf8 │            │ libc            │
>  template0 │ myon  │ UTF8     │ de_DE.utf8 │ de_DE.utf8 │            │ libc            │ =c/myon          ↵
>            │       │          │            │            │            │                 │ myon=CTc/myon
>  template1 │ myon  │ UTF8     │ de_DE.utf8 │ de_DE.utf8 │            │ libc            │ =c/myon          ↵
>            │       │          │            │            │            │                 │ myon=CTc/myon
> (3 rows)
Another gripe here: The above is the output when run against a PG15
cluster, created without an ICU locale set.
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.
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"
Christoph
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Euler Taveira | 2022-04-15 15:48:30 | Re: Inconsistent "ICU Locale" output on older server versions | 
| Previous Message | Christoph Berg | 2022-04-15 14:49:28 | Re: pgsql: Add TAP test to automate the equivalent of check_guc | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andres Freund | 2022-04-15 15:12:10 | Re: Intermittent buildfarm failures on wrasse | 
| Previous Message | Christoph Berg | 2022-04-15 14:49:28 | Re: pgsql: Add TAP test to automate the equivalent of check_guc |