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 1oSqcN-0000HL-Sv for pgsql-bugs@arkaria.postgresql.org; Tue, 30 Aug 2022 02:04:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oSqcM-0000ye-Jz for pgsql-bugs@arkaria.postgresql.org; Tue, 30 Aug 2022 02:04:42 +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 1oSqcM-0000yV-C9 for pgsql-bugs@lists.postgresql.org; Tue, 30 Aug 2022 02:04:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oSqcK-00050b-A3 for pgsql-bugs@lists.postgresql.org; Tue, 30 Aug 2022 02:04:41 +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 27U24dG43481974; Mon, 29 Aug 2022 22:04:39 -0400 From: Tom Lane To: Richard Guo cc: Etsuro Fujita , Alexander Pyhalov , PostgreSQL mailing lists Subject: Re: foreign join error "variable not found in subplan target list" In-reply-to: References: Comments: In-reply-to Richard Guo message dated "Tue, 30 Aug 2022 09:18:54 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3481972.1661825079.1@sss.pgh.pa.us> Date: Mon, 29 Aug 2022 22:04:39 -0400 Message-ID: <3481973.1661825079@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > To be concrete, I mean something like this: > + /* Update the cost and width fields if we have added any > new columns. */ > + if (!equal(epq_path->pathtarget->exprs, target->exprs)) > + set_pathtarget_cost_width(root, target); Wouldn't a list_length() comparison be sufficient? equal() seems like overkill. regards, tom lane