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 1jr70s-0001D4-EN for pgsql-general@arkaria.postgresql.org; Thu, 02 Jul 2020 21:44:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jr70r-0000AP-Ci for pgsql-general@arkaria.postgresql.org; Thu, 02 Jul 2020 21:44:57 +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 1jr70r-0000AI-5L for pgsql-general@lists.postgresql.org; Thu, 02 Jul 2020 21:44:57 +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 1jr70o-0002zF-W0 for pgsql-general@lists.postgresql.org; Thu, 02 Jul 2020 21:44:56 +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 062LirUJ889661; Thu, 2 Jul 2020 17:44:53 -0400 From: Tom Lane To: Anders Steinlein cc: pgsql-general Subject: Re: Different results from identical matviews In-reply-to: References: <815598.1593648137@sss.pgh.pa.us> <849797.1593697489@sss.pgh.pa.us> <854382.1593704633@sss.pgh.pa.us> Comments: In-reply-to Anders Steinlein message dated "Thu, 02 Jul 2020 23:32:48 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <889659.1593726293.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 02 Jul 2020 17:44:53 -0400 Message-ID: <889660.1593726293@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Anders Steinlein writes: > On Thu, Jul 2, 2020 at 5:43 PM Tom Lane wrote: >> Unfortunately, >> since the reverse-listing of this join is just going to say "USING >> (email)", there's no way to detect from human-readable output that the >> interpretation of the USING clauses is different. (We've contemplated >> introducing not-SQL-standard syntax to allow flagging such cases, but >> haven't pulled the trigger on that.) > If I'm reading this correctly, would this be a "reason" to be more expli= cit > when doing joins involving non-standard data types? I.e. would it be > "safer" to do ON x1.email::citext =3D=3D x2.email::citext instead of USI= NG (if > there is any difference at all...)? Yes, it would be. Of course then you don't get the "merging" of the two join output columns into one, so you might have to qualify references a bit more. You might find this thread interesting: https://www.postgresql.org/message-id/flat/ffefc172-a487-aa87-a0e7-472bf29= 735c8%40gmail.com regards, tom lane