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 1pWWvd-0003jh-Ht for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Feb 2023 06:24:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pWWvc-0007TE-6q for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Feb 2023 06:24:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pWWvb-0007T5-PA for pgsql-bugs@lists.postgresql.org; Mon, 27 Feb 2023 06:24:03 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pWWvX-0004rq-5S for pgsql-bugs@lists.postgresql.org; Mon, 27 Feb 2023 06:24:03 +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 138F321C82F9; Mon, 27 Feb 2023 09:23:57 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1677479038; bh=7UVn6bgNuwuP80pxUfRIPGfifWex1nCxdCjCfZRGO5Q=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=CVwIXqufgf5bFx/PzZPmqAIzTnGcvUxvQz7c2YULiiV1U/LRX7sovNO7X+9ma6gaL oExWzQoWtCTReiXik2PKWiBcbBnY5PHO7PJucbUhDMAPISFh/pErMbZ2dulD+NA0uR 74HakyMfkqqRbVf43aABZb6F6BONgpefPzKUQFhk= Message-ID: Date: Mon, 27 Feb 2023 11:23:57 +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) To: Richard Guo Cc: PostgreSQL mailing lists References: <0b819232-4b50-f245-1c7d-c8c61bf41827@postgrespro.ru> 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 23/2/2023 11:36, Richard Guo wrote: > I've realized this hack is not correct :-(.  References to A Vars and B > Vars in higher qual levels do not need this adjustment.  So this code > change would add unnecessary relids for clauses that involve A Vars or B > Vars but not C Vars, resulting them being placed at higher place than > needed. > > Maybe what we need is to add in commute_below_l (assuming it has been > recorded in SpecialJoinInfo) rather than commute_below of outer joins > mentioned within the clause? 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? -- regards, Andrey Lepikhov Postgres Professional