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 1pWZ2o-0002fX-73 for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Feb 2023 08:39:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pWZ2m-0003Nl-Ml for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Feb 2023 08:39:36 +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 1pWZ2m-0003Nc-99 for pgsql-bugs@lists.postgresql.org; Mon, 27 Feb 2023 08:39:36 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pWZ2j-0002P5-Ap for pgsql-bugs@lists.postgresql.org; Mon, 27 Feb 2023 08:39:35 +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 279B221CAA92; Mon, 27 Feb 2023 11:39:30 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1677487170; bh=BihbvHGUN+Cc9bJZtCX5q4iO4qAshiAEeq+rvnD5QBA=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=Yu2AWOFTOw/+Pez668QrBlmZ57p7GLRanyrtvMBuE7uCL6dk9gMKM32/XpiIenXhR eN1TqarclL8iQNbbtAOPosixg0h5/w6EFQG9R/D9e5hHQkdY3hukbuPd57S17p92bM Ctw3Jg2kXCfj87UfW9EWr3ZnXbBevM84Sj/j9cUc= Message-ID: Date: Mon, 27 Feb 2023 13:39:29 +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: Richard Guo Cc: PostgreSQL mailing lists References: <0b819232-4b50-f245-1c7d-c8c61bf41827@postgrespro.ru> 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 27/2/2023 13:16, Richard Guo wrote: > > On Mon, Feb 27, 2023 at 2:23 PM Andrey Lepikhov > > wrote: > > Doing a comparison of pg15 and master initsplan.c I found that a clear > and documented algorithm for delaying the application of a qual is lost > or replaced with some commute_* fields. > It is not clear how we guarantee correct application delay of a qual. > Which part of the code implements it now? > > 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. relnode.c::build_joinrel_tlist() adds relid into varnullingrels only in the case when the var exists in the target list. So, other joins, which don't have links to the var, don't get into the bitmapset too. -- regards, Andrey Lepikhov Postgres Professional