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 1mOMTV-0004EO-7n for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Sep 2021 16:00:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mOMTT-0006Ei-T9 for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Sep 2021 16:00:27 +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 1mOMTT-0006Ea-LH for pgsql-hackers@lists.postgresql.org; Thu, 09 Sep 2021 16:00:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mOMTQ-0003Xl-5R for pgsql-hackers@lists.postgresql.org; Thu, 09 Sep 2021 16:00:26 +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 189G0LE23683995; Thu, 9 Sep 2021 12:00:21 -0400 From: Tom Lane To: Etsuro Fujita cc: Ibrar Ahmed , PostgreSQL Hackers , Neil Chen Subject: Re: BUG #16583: merge join on tables with different DB collation behind postgres_fdw fails In-reply-to: References: <16583-4dc8f6c3b8ed24fa@postgresql.org> <422379.1612684550@sss.pgh.pa.us> <161476090989.29967.7097745522340560681.pgcf@coridan.postgresql.org> <3404441.1626208861@sss.pgh.pa.us> <2201880.1630528969@sss.pgh.pa.us> Comments: In-reply-to Etsuro Fujita message dated "Fri, 10 Sep 2021 00:45:32 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3683992.1631203221.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Thu, 09 Sep 2021 12:00:21 -0400 Message-ID: <3683993.1631203221@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Etsuro Fujita writes: > On Thu, Sep 2, 2021 at 5:42 AM Tom Lane wrote: >> The real reason that this hasn't gotten committed is that I remain >> pretty uncomfortable about whether it's an acceptable solution to >> the problem. Suddenly asking people to plaster COLLATE clauses >> on all their textual remote columns seems like a big compatibility >> gotcha. > I think so too. Yeah :-(. It seems like a very unpleasant change. > Having said that, I think another option for this would be to left the > code as-is; assume that 1) the foreign var has "COLLATE default”, not > an unknown collation, when labeled with "COLLATE default”, and 2) > "COLLATE default” on the local database matches "COLLATE default” on > the remote database. The fundamental complaint that started this thread was exactly that assumption (2) isn't safe. So it sounds to me like you're proposing that we do nothing, which isn't a great answer either. I suppose we could try documenting our way out of this, but people will continue to get bit because they won't read or won't understand the limitation. I'd be happier if we had a way to check whether the local and remote default collations are compatible. But it seems like that's a big ask, especially in cross-operating-system situations. regards, tom lane