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 1ppMVX-0005bi-KB for pgsql-bugs@arkaria.postgresql.org; Thu, 20 Apr 2023 05:07:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ppMVV-0005hx-6P for pgsql-bugs@arkaria.postgresql.org; Thu, 20 Apr 2023 05:06: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 1ppMVU-0005ho-OV for pgsql-bugs@lists.postgresql.org; Thu, 20 Apr 2023 05:06:56 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ppMVR-000okR-BX for pgsql-bugs@lists.postgresql.org; Thu, 20 Apr 2023 05:06:55 +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/587) with ESMTPSA id B105621CCA4D; Thu, 20 Apr 2023 08:06:51 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1681967211; bh=Vg+8Td171bVSUEVbgEoheBB4BFaLrHpU78qI+1AeLsg=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=MqmCY0hOHhvG+iWdb4XLJOspfD/Rz3Jf9DxNKL0FryCI2cyARHk2avzY004rK6KN6 33u6pjCTuAOM+BODvliv5SWK8KgkY5n7HiTXoiU7Lp+w8M14s5L21OjPWvlg8hpIN2 RNV1QpgyrWeK7rDo4U0jYqy8GXq0etXWWmuazJfpxyRRl/vcNBOVcM5OxlDwyUn02X qgqb8cd1RxLAPt46l8SOOaapKe0JcJvxR/sRRhmdgb077fNPLiHkaBoKWfyVArVWFd C2ATP3oZuNNKcP2+tJZAI86icMkzPuKVnJPTbvJlVWrQvQRC4oE85NxBQiV0eLn14X mCinVdUDE9wHg== Message-ID: Date: Thu, 20 Apr 2023 10:06:51 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware) To: Richard Guo , Tom Lane Cc: PostgreSQL mailing lists References: <0b819232-4b50-f245-1c7d-c8c61bf41827@postgrespro.ru> <402433.1677524538@sss.pgh.pa.us> <2663884e-769a-b298-55b0-014c5a1ee55c@postgrespro.ru> <524303.1677538463@sss.pgh.pa.us> <999171.1677611407@sss.pgh.pa.us> Content-Language: en-US From: Andrey Lepikhov Organization: Postgres Professional In-Reply-To: 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 4/4/23 08:00, Richard Guo wrote: > I found a thinko in the v1 patch: we need to consider syn_righthand > rather than min_righthand of the pushed down outer joins as we want to > know if the Var or PHV actually comes from within the syntactically > nullable sides.  Attach v2 to fix this. > > I have some concerns that the new added foreach loop is too expensive to > be doing for each Var or PHV.  But maybe it's no problem since we only > loop over pushed down joins here. I have passed through your patch and the 'postpone-adding-pushed-down-ojrelid-to-relids' patch step-by-step. It looks logically correct. Honestly, I don't happy with the top patch, because it looks a bit peculiar, but the sqlancer long test (which detected the problem before) didn't show any problems here. But one thought is bugging me: do we have a guarantee, what with these Identity 3 transformations and 'delaying up to completely performed' technique we don't lose some joininfo clauses? -- Regards Andrey Lepikhov Postgres Professional