Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNgUf-0004Ou-Jz for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Oct 2019 17:01:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iNgUd-0002wZ-OW for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Oct 2019 17:01:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNgUd-0002tn-Fm for pgsql-bugs@lists.postgresql.org; Thu, 24 Oct 2019 17:01:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNgUW-00039i-3J for pgsql-bugs@lists.postgresql.org; Thu, 24 Oct 2019 17:01:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x9OH1a55011506; Thu, 24 Oct 2019 13:01:36 -0400 From: Tom Lane To: thomas.bessou@stockly.ai cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16077: Sorting of table list depends on platform In-reply-to: <16077-6f297cabd744c86c@postgresql.org> References: <16077-6f297cabd744c86c@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 24 Oct 2019 16:09:58 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11504.1571936496.1@sss.pgh.pa.us> Date: Thu, 24 Oct 2019 13:01:36 -0400 Message-ID: <11505.1571936496@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > Running the following query: > ``` > SELECT table_name, table_schema from information_schema.tables > WHERE table_schema = 'your schema' AND table_type LIKE 'BASE TABLE' ORDER BY > table_name; > ``` > The output differs on Linux and Mac versions, though the tables are the same > (setup by the same script from an empty database). > We would assume ORDER BY has the same behaviour on all platforms. Unfortunately, that assumption is wrong. As it happens, this particular query will sort consistently beginning in v12, because the information_schema object name columns will now use C collation by default; before that they used the database's default collation. But *all* non-C collations are potentially platform-dependent, because there's not a lot of agreement between different libc vendors as to what the sort order is, even for the "same" locale name. Postgres is not in a position to impose some kind of standard there. We have some documentation about this: https://www.postgresql.org/docs/current/locale.html regards, tom lane