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 1nFtya-0000Dr-KT for pgsql-general@arkaria.postgresql.org; Fri, 04 Feb 2022 08:29:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nFty2-0005RI-6K for pgsql-general@arkaria.postgresql.org; Fri, 04 Feb 2022 08:29:18 +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 1nFty1-0005R6-RN for pgsql-general@lists.postgresql.org; Fri, 04 Feb 2022 08:29:17 +0000 Received: from smh-06.1blu.de ([178.254.0.206]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nFtxu-0006Xn-ID for pgsql-general@lists.postgresql.org; Fri, 04 Feb 2022 08:29:16 +0000 Received: from [172.16.29.5] (helo=sh4-5.1blu.de) by smh-06.1blu.de with esmtp (Exim 4.90_1) (envelope-from ) id 1nFtxp-0000cE-H0; Fri, 04 Feb 2022 09:29:05 +0100 Received: from localhost ([127.0.0.1]) by sh4-5.1blu.de with esmtp (Exim 4.90_1) (envelope-from ) id 1nFtxp-0002PI-E4; Fri, 04 Feb 2022 09:29:05 +0100 Date: Fri, 4 Feb 2022 09:29:05 +0100 From: Matthias Apitz To: Tom Lane Cc: pgsql-general@lists.postgresql.org Subject: Re: sort order for UTF-8 char column with Japanese UTF-8 Message-ID: <20220204082905.GA28@sh4-5.1blu.de> Reply-To: Matthias Apitz References: <253777.1643900437@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <253777.1643900437@sss.pgh.pa.us> X-Operating-System: FreeBSD 12.0-CURRENT r314251 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk El día Donnerstag, Februar 03, 2022 a las 10:00:37 -0500, Tom Lane escribió: > Matthias Apitz writes: > > El día jueves, febrero 03, 2022 a las 11:14:55 +0100, Matthias Apitz escribió: > >> With ESQL/C on a PostgreSQL 13.1 server I see the result of this query: > >> select katkey,normform from swd_anzeige where normform >= 'A' ORDER BY ASC; > >> coming out in this order: > >> ... > >> I loaded the same table in my server, but can't get the same order with > >> psql: > > Do the two machines produce the same results if you sort the data in > question with sort(1)? (Being careful to set LANG=de_DE.UTF-8 of > course.) I rather doubt this has anything to do with Postgres as such; > there are lots of inter-system and inter-release discrepancies in > collation behavior. No, they do not. I gathered from the admin of the remote (customer) server the output of sort(1) in dependency of LANG and LC_ALL (see below). Only when I let her unset the UTF-8 env vars, the result is with the Japanese lines at the end, with UTF-8 env they're sorted at the beginning. On my own server (the only difference is that my server is SUSE Linux Enterprise Server 15 SP3, while the customer still runs SP2) I never get the Japanese lines on top with the same commands as used by the remote admin. I requested now in addition the output of ls -l /lib64/libc.* /usr/lib/locale/de_DE.utf8 to see if the libc version is different, mine is libc-2.31.so Said that, does the SORT done by the server depends on the environment (LANG, LC_*) in which the PostgreSQL server is started or only of the sp_catalog information of the database in question? Thanks matthias LC_ALL=de_DE.UTF-8 sort swd A ゲアハルト・A・リッター ゲルハルト・A・リッター チャールズ・A・ビアード A010STRUKTUR A010STRUKTUR A010STRUKTUR A0150SUPRALEITER LANG=de_DE.UTF-8 sort swd A ゲアハルト・A・リッター ゲルハルト・A・リッター チャールズ・A・ビアード A010STRUKTUR A010STRUKTUR A010STRUKTUR A0150SUPRALEITER sort swd A ゲアハルト・A・リッター ゲルハルト・A・リッター チャールズ・A・ビアード A010STRUKTUR A010STRUKTUR A010STRUKTUR A0150SUPRALEITER env | grep LC LC_ALL=de_DE.UTF-8 env | grep LANG LANG=de_DE.UTF-8 unset LC_ALL LC_COLLATE LANG sort swd A A010STRUKTUR A010STRUKTUR A010STRUKTUR A0150SUPRALEITER ゲアハルト・A・リッター ゲルハルト・A・リッター チャールズ・A・ビアード -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!