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 1knfrW-0001Eb-FA for pgsql-general@arkaria.postgresql.org; Fri, 11 Dec 2020 10:41:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1knfrV-00089d-90 for pgsql-general@arkaria.postgresql.org; Fri, 11 Dec 2020 10:41:21 +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 1kneC5-0003qp-6t for pgsql-general@lists.postgresql.org; Fri, 11 Dec 2020 08:54:29 +0000 Received: from mail.augure-ng.fr ([212.83.133.16]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kneC0-0005q2-Jb for pgsql-general@lists.postgresql.org; Fri, 11 Dec 2020 08:54:28 +0000 Subject: Re: Set COLLATE on a session level DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=augure-ng.fr; s=mail; t=1607676861; bh=7jl8w+CHqbue9n/GibZpvzNNhpLNoLox5jZbb4DHIpE=; h=Subject:To:References:From:Date:In-Reply-To:From; b=fLE0CzjUExCog5jNh5pD1eGvADME+H6EAOf9qx4BphDEIoy5aRQoZQ7JoqHo+aJVi Q2z6jvUQvePEs3KxNHnw1TammT8FCCTpm6KiW7GVeuxpU8jX/dSZzLxjJ6UTC6wGza Rn2q6b5AF1oyGDTTNf+US638IXf1dH7WBddPG7U4= To: pgsql-general@lists.postgresql.org References: <0DDE56FB-89A8-4621-BF5E-8CE3461F4983@mikatiming.de> <98a8cdc2-ed4b-616c-7370-3d5e5ccb8f91@enterprisedb.com> <2156565.1607098719@sss.pgh.pa.us> <67253506-9381-44ac-0bbd-5b4aea29cc19@enterprisedb.com> <03ede77a49f4e8085d885e0dc1c66128ebed8e27.camel@cybertec.at> <0F3D30C2-8175-4453-9285-10584605E8DD@mikatiming.de> From: Alexandre GRAIL Organization: Augure Engineering Message-ID: <6c0e85fb-faad-7209-94b5-ca25c5b3002d@augure-ng.fr> Date: Fri, 11 Dec 2020 09:54:20 +0100 MIME-Version: 1.0 In-Reply-To: <0F3D30C2-8175-4453-9285-10584605E8DD@mikatiming.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/12/2020 19:33, Dirk Mika wrote: >>>> 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. >>> >> I think it would be analogous to the schema search path. > Usually you notice right away if the "search_path" is wrong, because > relations won't be found. > > But with a bad collation set in a session, the problems would be more > subtle. For example, if someone asks you why an index isn't used to > support sorting, you'd always have to remember to ask what collation > has been set in the session. If that information appear in the explain output, you won’'t have to ask. For people working in multilingual environment, a collation setting within session absolutely makes sense. So you don’t have to specify the same setting at each and every query. Also, the expected ordering do depends on the user who do the query (and his expectation from the language he’s working in) and *not* the data itself. Regards