Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nfNP7-0006Dn-Ua for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Apr 2022 14:58:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nfNP6-0006LY-QU for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Apr 2022 14:58:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nfNP6-0006LO-Gw for pgsql-hackers@lists.postgresql.org; Fri, 15 Apr 2022 14:58:32 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nfNP4-0006O1-Bc for pgsql-hackers@lists.postgresql.org; Fri, 15 Apr 2022 14:58:31 +0000 Received: from msg.df7cb.de (ip5f584383.dynamic.kabel-deutschland.de [95.88.67.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 4Kfzwh5myqz3F14; Fri, 15 Apr 2022 16:58:28 +0200 (CEST) Date: Fri, 15 Apr 2022 16:58:28 +0200 From: Christoph Berg To: Peter Eisentraut Cc: pgsql-hackers@lists.postgresql.org Subject: Inconsistent "ICU Locale" output on older server versions Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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