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 1tIVdf-00EmTW-8B for pgsql-committers@arkaria.postgresql.org; Tue, 03 Dec 2024 16:20:39 +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 1tIVdc-00B3C5-PE for pgsql-committers@arkaria.postgresql.org; Tue, 03 Dec 2024 16:20:37 +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 1tIVdc-00B3Aa-Ha for pgsql-committers@lists.postgresql.org; Tue, 03 Dec 2024 16:20:37 +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 1tIVdb-000qnJ-8h for pgsql-committers@lists.postgresql.org; Tue, 03 Dec 2024 16:20:36 +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 4B3GKWp01822437; Tue, 3 Dec 2024 11:20:32 -0500 From: Tom Lane To: Andrei Lepikhov cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Avoid mislabeling of lateral references when pulling up a subque In-reply-to: <7d8175ca-82bb-4878-8b25-7edb124fac21@gmail.com> References: <7d8175ca-82bb-4878-8b25-7edb124fac21@gmail.com> Comments: In-reply-to Andrei Lepikhov message dated "Tue, 03 Dec 2024 16:15:20 +0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1822435.1733242832.1@sss.pgh.pa.us> Date: Tue, 03 Dec 2024 11:20:32 -0500 Message-ID: <1822436.1733242832@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrei Lepikhov writes: > Pardon the noise, but I'm curious why the optimiser must choose NestLoop > in the case of lateral reference. To pass down the current outer row's value of the lateral reference. > It would be nice to provide alternatives. Because now we have some > corner cases. That's a fairly bizarre case, and I'm not at all convinced that the old plan was correct. regards, tom lane