Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tGq3f-001Anv-Cx for pgsql-committers@arkaria.postgresql.org; Fri, 29 Nov 2024 01:44:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tGq3c-002zW8-S2 for pgsql-committers@arkaria.postgresql.org; Fri, 29 Nov 2024 01:44:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tGq3c-002zW0-Kw for pgsql-committers@lists.postgresql.org; Fri, 29 Nov 2024 01:44:33 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tGq3b-0005WE-Cl for pgsql-committers@lists.postgresql.org; Fri, 29 Nov 2024 01:44:32 +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 4AT1iURd397372; Thu, 28 Nov 2024 20:44:30 -0500 From: Tom Lane To: Richard Guo cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Avoid mislabeling of lateral references when pulling up a subque In-reply-to: References: Comments: In-reply-to Richard Guo message dated "Fri, 29 Nov 2024 10:36:19 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <397370.1732844670.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Thu, 28 Nov 2024 20:44:30 -0500 Message-ID: <397371.1732844670@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > On Fri, Nov 29, 2024 at 7:33 AM Tom Lane wrote: >> It seems to be sufficient to just not mark lateral >> references at all in this case. (I have a nagging feeling that more >> complexity may be needed in cases where there are several levels of >> outer join, but some attempts to break it with that didn't succeed.) > You're right about your feeling. Here is a query that breaks it. Ah, thanks for the test case. I'll look into it tomorrow. regards, tom lane