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 1nfOC8-0000hR-0O for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Apr 2022 15:49:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nfOC5-0000ks-J7 for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Apr 2022 15:49:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nfOC4-0000kj-Gi for pgsql-hackers@lists.postgresql.org; Fri, 15 Apr 2022 15:49:09 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nfOBw-0001ue-Li for pgsql-hackers@lists.postgresql.org; Fri, 15 Apr 2022 15:49:08 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 6E1D532021DC; Fri, 15 Apr 2022 11:48:57 -0400 (EDT) Received: from imap49 ([10.202.2.99]) by compute2.internal (MEProxy); Fri, 15 Apr 2022 11:48:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1650037736; x=1650124136; bh=immd5DIaKO MiDlrz2dqSkqiF6vGlBYQUeoYPGAucoms=; b=T73212iWkxwm1S0bRRkKtNR2vT Qt8p2EonfqL+5nmHs5zQc03oKZuYlOdsTZgtkLJiZBoHvZKSkQ/P6ZIGAWj7YMHy h1pSuoCa0vC9lYGjMen3yIqwfwDlTf0fuXDnyknXrd23mORo8UTTjt6shI6OHe+x n0FR8ro3lpG2jJij7+ApzWGQlZn+Nt/YdCQCreXsdJgKKfjNj3bsgkpockDhT1hk +VV+KhGz8IUILjFxdhsUVrJ4SBydGebO0bsw9qgEZy0nsY7B2FicLlVIckbifnIW BbDWwYyhsBvA7UhG5vhGfhJAG0jvf4309Ufg8BgKGTiW3MhMoK8fXxflueOg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1650037736; x= 1650124136; bh=immd5DIaKOMiDlrz2dqSkqiF6vGlBYQUeoYPGAucoms=; b=j fQ/nBZ99Bkemb4mpytggc1j6pf31DhogrDs8BkuOrqaR0na971/K5yAS11Mvw4pl zbepXEpjmjmSyPldBJOUsGngECUkJSDlR3E2pb35VPHRZdpxhwyWWK9pCiT+KGIN 1cLQafN0RZwd6L4V3iwTUDgakymUcmo4Db/4PXOMoNJryLrhXPiKYIW76ItaZvz5 epN64+jyh3BlnXkQ9eNSjVXOa8Y3/o+bidXQ1HcyhPqlpMFWVau5lNuIqktmDDYO 0NEUkDNJYHTxoUfWjcfZcgq3utPOjSVFjwDZcA+Tbv91JIdDs+2TJEqkdxyWicDb U38Z3IiuZMKNIfza7drQg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudelhedgleegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesrgdtreerreerjeenucfhrhhomhepfdfguhhl vghrucfvrghvvghirhgrfdcuoegvuhhlvghrsegvuhhlvghrthhordgtohhmqeenucggtf frrghtthgvrhhnpeeiffdtgfdvgefhgefgtdejtdfffedvgfeuffegtdfffeduieeuvdeh gfegveelkeenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepvghulhgvrhesvghu lhgvrhhtohdrtghomh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id ADB6915A0069; Fri, 15 Apr 2022 11:48:56 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-387-g7ea99c4045-fm-20220413.002-g7ea99c40 Mime-Version: 1.0 Message-Id: In-Reply-To: References: Date: Fri, 15 Apr 2022 12:48:30 -0300 From: "Euler Taveira" To: "Christoph Berg" , "Peter Eisentraut" Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Inconsistent "ICU Locale" output on older server versions Content-Type: multipart/alternative; boundary=8723cdd5837f4a708837afe630e723c6 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --8723cdd5837f4a708837afe630e723c6 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, Apr 15, 2022, at 11:58 AM, Christoph Berg wrote: > When running psql 15 against PG 14, the output is this: >=20 > $ psql -l > List of databases > Name =E2=94=82 Owner =E2=94=82 Encoding =E2=94=82 Collate = =E2=94=82 Ctype =E2=94=82 ICU Locale =E2=94=82 Locale Provider =E2=94= =82 Access privileges > =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80 > postgres =E2=94=82 postgres =E2=94=82 UTF8 =E2=94=82 de_DE.utf8 =E2= =94=82 de_DE.utf8 =E2=94=82 de_DE.utf8 =E2=94=82 libc =E2=94=82 > template0 =E2=94=82 postgres =E2=94=82 UTF8 =E2=94=82 de_DE.utf8 =E2= =94=82 de_DE.utf8 =E2=94=82 de_DE.utf8 =E2=94=82 libc =E2=94=82= =3Dc/postgres =E2=86=B5 > =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 =E2=94=82 =E2=94=82 =E2=94= =82 postgres=3DCTc/postgres > template1 =E2=94=82 postgres =E2=94=82 UTF8 =E2=94=82 de_DE.utf8 =E2= =94=82 de_DE.utf8 =E2=94=82 de_DE.utf8 =E2=94=82 libc =E2=94=82= =3Dc/postgres =E2=86=B5 > =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 =E2=94=82 =E2=94=82 =E2=94= =82 postgres=3DCTc/postgres > (3 rows) >=20 > 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: >=20 > + if (pset.sversion >=3D 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" <--- the= re > + " 'libc' AS \"%s\",\n", > + gettext_noop("ICU Locale"), > + gettext_noop("Locale Provider")); >=20 > I'd think this should rather be >=20 > + " '' 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 l= ibc. -- Euler Taveira EDB https://www.enterprisedb.com/ --8723cdd5837f4a708837afe630e723c6 Content-Type: text/html;charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Fri, Apr 15,= 2022, at 11:58 AM, Christoph Berg wrote:
When running psql 15 against PG 14, the o= utput is this:

$ psql -l
&nbs= p;           &nbs= p;           &nbs= p;           &nbs= p;           List of d= atabases
   Name    =E2=94=82&nbs= p; Owner   =E2=94=82 Encoding =E2=94=82  Collate &nb= sp; =E2=94=82   Ctype    =E2=94=82 ICU Locale =E2= =94=82 Locale Provider =E2=94=82   Access privileges
=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80
postgres  =E2=94=82 postgres =E2= =94=82 UTF8     =E2=94=82 de_DE.utf8 =E2=94=82 de_DE= .utf8 =E2=94=82 de_DE.utf8 =E2=94=82 libc     &= nbsp;      =E2=94=82
template0 =E2= =94=82 postgres =E2=94=82 UTF8     =E2=94=82 de_DE.u= tf8 =E2=94=82 de_DE.utf8 =E2=94=82 de_DE.utf8 =E2=94=82 libc  =           =E2=94=82 =3Dc/po= stgres          =E2=86=B5
          = ; =E2=94=82          =E2=94= =82          =E2=94=82 = ;           =E2=94=82&= nbsp;           =E2=94= =82            =E2= =94=82           =       =E2=94=82 postgres=3DCTc/postgres
template1 =E2=94=82 postgres =E2=94=82 UTF8   &nbs= p; =E2=94=82 de_DE.utf8 =E2=94=82 de_DE.utf8 =E2=94=82 de_DE.utf8 =E2=94= =82 libc          &nbs= p; =E2=94=82 =3Dc/postgres       &nbs= p;  =E2=86=B5
      &nb= sp;    =E2=94=82       = ;   =E2=94=82        &= nbsp; =E2=94=82         &nb= sp;  =E2=94=82         = ;   =E2=94=82        &= nbsp;   =E2=94=82       &nb= sp;         =E2=94=82 postgres=3D= CTc/postgres
(3 rows)

The "IC= U Locale" column is now populated, that seems wrong.
Good catch!

The problem is in the else branch in src/bin/psql/de= scribe.c around
line 900:

+&n= bsp;  if (pset.sversion >=3D 150000)
+  =      appendPQExpBuffer(&buf,
+&nbs= p;           &nbs= p;            "&n= bsp;      d.daticulocale as \"%s\",\n"
+           = ;            = ;  "       CASE d.datlocprovider WHEN= 'c' THEN 'libc' WHEN 'i' THEN 'icu' END AS \"%s\",\
+&nbs= p;           &nbs= p;            get= text_noop("ICU Locale"),
+     &n= bsp;           &n= bsp;       gettext_noop("Locale Provider")= );
+   else
+   &nb= sp;   appendPQExpBuffer(&buf,
+  &= nbsp;           &= nbsp;          "  = ;     d.datcollate as \"%s\",\n"  <--- there=
+         &n= bsp;           &n= bsp;   "       'libc' AS \"%s\",= \n",
+        &nbs= p;           &nbs= p;    gettext_noop("ICU Locale"),
+ &n= bsp;           &n= bsp;           gettext= _noop("Locale Provider"));

I'd think this s= hould rather be

+    &n= bsp;           &n= bsp;        "    =    '' as \"%s\",\n"
Since dataiculo= cale allows NULL, my suggestion is to use NULL instead of an
empty string. It is consistent with a cluster whose locale provi= der is libc.


--
Euler Tav= eira

--8723cdd5837f4a708837afe630e723c6--