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 1klDnC-00035j-9w for pgsql-general@arkaria.postgresql.org; Fri, 04 Dec 2020 16:18:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1klDnB-0000wh-95 for pgsql-general@arkaria.postgresql.org; Fri, 04 Dec 2020 16:18:45 +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 1klDnB-0000v4-18 for pgsql-general@lists.postgresql.org; Fri, 04 Dec 2020 16:18:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1klDn9-0003QC-0f for pgsql-general@lists.postgresql.org; Fri, 04 Dec 2020 16:18:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 0B4GIdFk2156566; Fri, 4 Dec 2020 11:18:40 -0500 From: Tom Lane To: Peter Eisentraut cc: Dirk Mika , "pgsql-general@lists.postgresql.org" Subject: Re: Set COLLATE on a session level In-reply-to: <98a8cdc2-ed4b-616c-7370-3d5e5ccb8f91@enterprisedb.com> References: <0DDE56FB-89A8-4621-BF5E-8CE3461F4983@mikatiming.de> <98a8cdc2-ed4b-616c-7370-3d5e5ccb8f91@enterprisedb.com> Comments: In-reply-to Peter Eisentraut message dated "Fri, 04 Dec 2020 17:00:54 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2156564.1607098719.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2020 11:18:39 -0500 Message-ID: <2156565.1607098719@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Eisentraut writes: > On 2020-11-20 08:13, Dirk Mika wrote: >> I know that I can specify a COLLATE for a SELECT statement in the ORDER= BY Clause, but then I would have to adjust the statements in the client a= nd statements that are automatically generated by the database components = used, would not be affected. > There is a SET COLLATION command in the SQL standard that does this. = > Someone just has to implement it. It wouldn't be terribly difficult, I = > think. [ squint... ] Just because it's in the standard doesn't mean it's a good idea. It sounds like this is morally equivalent to a GUC that changes query semantics. We have learned painfully that such behaviors are best avoided, because they break things you didn't expect to break. (I also wonder just exactly what such a setting would do, and how it interacts with the existing rules for deriving collations within a query. Does parse_collate.c go out the window the minute somebody sets a non-empty collation setting?) regards, tom lane