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 1pWltm-0002ow-N3 for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Feb 2023 22:23:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pWltl-0003Tc-E7 for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Feb 2023 22:23:09 +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 1pWltl-0003TS-0G for pgsql-bugs@lists.postgresql.org; Mon, 27 Feb 2023 22:23:09 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pWlth-00018J-Vg for pgsql-bugs@lists.postgresql.org; Mon, 27 Feb 2023 22:23:07 +0000 Received: from [192.168.28.53] (cyclops.postgrespro.ru [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 1E9AB21CC93D; Tue, 28 Feb 2023 01:23:03 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1677536583; bh=Kc7DbchPzjCjCOW8wKsuJ8zJ5Qt+Qxlv2sJjDXtO+x0=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=denaGMYHAj6ltB/BpBz6UPilEfTHWlYQjZIYHywgvU98FH2Cy/78BlPmYcL5qBt8Q iX5hUNcdRIvWEswpo0FRs+B1+//bi4avTZNxLnVv4gZOn+fnCLQorZHPAPczVm+x5N TPuJAvreThlQ4pKnrCqP9QsH9kgPptyhVcwQqGgc= Message-ID: <2663884e-769a-b298-55b0-014c5a1ee55c@postgrespro.ru> Date: Tue, 28 Feb 2023 03:23:02 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware) Content-Language: en-US To: Tom Lane Cc: Richard Guo , PostgreSQL mailing lists References: <0b819232-4b50-f245-1c7d-c8c61bf41827@postgrespro.ru> <402433.1677524538@sss.pgh.pa.us> From: Andrey Lepikhov Organization: Postgres Professional In-Reply-To: <402433.1677524538@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 28/2/2023 00:02, Tom Lane wrote: > 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. > 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. Ok, maybe my language still not so fluent, as I think sometimes. In accordance to the example above: 1. varnullingrels contains relids of entries which can null the var. In our case it (correctly) contains t3 and OJ(t3,t4) 2. Syntactic scope of the clause correctly contains all relations and OJs 3. In the distribute_qual_to_rels I don't see a code which should disallow pushing down a clause from higher syntactic level into nullable side of OJ. Where is the logic which should limit the lowest level of the clause push down? -- regards, Andrey Lepikhov Postgres Professional