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 1pWilX-0001Qz-0G for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Feb 2023 19:02:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pWilV-0008Iw-UP for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Feb 2023 19:02:25 +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 1pWilV-0008In-Lj for pgsql-bugs@lists.postgresql.org; Mon, 27 Feb 2023 19:02:25 +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 1pWilR-0007om-Pw for pgsql-bugs@lists.postgresql.org; Mon, 27 Feb 2023 19:02:24 +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 31RJ2I0R402434; Mon, 27 Feb 2023 14:02:19 -0500 From: Tom Lane To: Andrey Lepikhov cc: Richard Guo , PostgreSQL mailing lists Subject: Re: Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware) In-reply-to: References: <0b819232-4b50-f245-1c7d-c8c61bf41827@postgrespro.ru> Comments: In-reply-to Andrey Lepikhov message dated "Mon, 27 Feb 2023 13:39:29 +0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <402432.1677524538.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 27 Feb 2023 14:02:18 -0500 Message-ID: <402433.1677524538@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrey Lepikhov writes: > On 27/2/2023 13:16, Richard Guo wrote: >> Do you mean function check_outerjoin_delay()?  Yes it has been removed >> in b448f1c8, since now we consider that outer joins listed in >> varnullingrels or phnullingrels are used in the clause, so that the >> clause would not be placed below outer joins that should null some of >> its vars. > I see. But these logics looks non-equivalent. They're not meant to be equivalent. The new code should be more flexible and more trustworthy --- in particular, there's nothing that didn't suck about the old outerjoin_delayed mechanism. Before we had only a very ad-hoc model of where outer-join quals could be evaluated. I've spent the last sixteen years living in fear that somebody would find a bug in it that couldn't be fixed without making many plans disastrously worse. Now we have something that actually faithfully represents where quals can be evaluated and why. Admittedly the new stuff is having more teething pains than I'd hoped for, but we'll work through it. Most of the bugs are stemming from the fact that we now need a rigorous representation of what is happening when we commute outer joins per identity 3, and we're finding out that we are not quite there yet. regards, tom lane