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 1pPnzB-0004SE-Vv for pgsql-bugs@arkaria.postgresql.org; Wed, 08 Feb 2023 17:11:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pPnzA-00038O-IF for pgsql-bugs@arkaria.postgresql.org; Wed, 08 Feb 2023 17:11:56 +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 1pPnzA-00038F-9n for pgsql-bugs@lists.postgresql.org; Wed, 08 Feb 2023 17:11:56 +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 1pPnz8-0008IX-0r for pgsql-bugs@lists.postgresql.org; Wed, 08 Feb 2023 17:11:55 +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 318HBqwP3499088; Wed, 8 Feb 2023 12:11:52 -0500 From: Tom Lane To: Richard Guo cc: Robins Tharakan , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17781: Assert in setrefs.c In-reply-to: References: <17781-c0405c8b3cd5e072@postgresql.org> <3384987.1675812417@sss.pgh.pa.us> Comments: In-reply-to Richard Guo message dated "Wed, 08 Feb 2023 17:15:24 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3499086.1675876312.1@sss.pgh.pa.us> Date: Wed, 08 Feb 2023 12:11:52 -0500 Message-ID: <3499087.1675876312@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > Hmm. I begin to wonder if it's better to use phinfo->ph_eval_at instead > in build_joinrel_tlist when we check whether the PHV actually comes from > the nullable side of an outer join. I wondered about that too, but I think phrels is probably preferable, because it is fundamentally a syntactic attribute and what we are after here is matching the syntactic structure. I could be convinced that that's wrong, but I'd want to see an actual counterexample. > Even so it seems we still need to update phv->phrels in > remove_rel_from_query when we remove a left join. Otherwise it'd be > weird to observe that phrels contains some already-removed relids. Agreed, that's a good catch. As the comment for remove_rel_from_query says, * We are not terribly thorough here. It's not surprising that the requirements for it advance over time. (At one point I wrote some code that taught it to clean out the removed relids from EquivalenceClasses, which doesn't need to happen right now because we don't ever put outer-join quals into EquivalenceClasses. I don't think I included that in any of the published versions of the patch series, but it's going to need to reappear eventually.) regards, tom lane