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 1rwNCU-001E9y-Iq for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Apr 2024 14:20:50 +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 1rwNCT-00DJgw-55 for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Apr 2024 14:20:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rwNCS-00DJgo-Sp for pgsql-bugs@lists.postgresql.org; Mon, 15 Apr 2024 14:20:48 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rwNCL-0015lH-VP for pgsql-bugs@lists.postgresql.org; Mon, 15 Apr 2024 14:20:48 +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 43FEKXXi742266; Mon, 15 Apr 2024 10:20:33 -0400 From: Tom Lane To: Richard Guo cc: Benoit Ryder , "David G. Johnston" , "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #18429: Inconsistent results on similar queries with join lateral In-reply-to: References: <18429-8982d4a348cc86c6@postgresql.org> <441100.1712933417@sss.pgh.pa.us> <450117.1712937002@sss.pgh.pa.us> <265068.1713049119@sss.pgh.pa.us> <508653.1713113077@sss.pgh.pa.us> Comments: In-reply-to Richard Guo message dated "Mon, 15 Apr 2024 17:09:19 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <742264.1713190833.1@sss.pgh.pa.us> Date: Mon, 15 Apr 2024 10:20:33 -0400 Message-ID: <742265.1713190833@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > I agree that the new test case for v15 does not seem to be worth > including in v16+. It seems to me that it would be better if we can > have another new test case to verify that we've included child rel's > em_relids even for appendrel child relations with pseudoconstant > translated variables, i.e. to verify that the change in equivclass.c > takes effect. Maybe with a query like below: > explain (costs off) > select * from tenk1 t1 > left join lateral > (select t1.unique1 as t1u, 0 as c > union all > select t1.unique1 as t1u, 1 as c) s on true > where t1.unique1 = s.c; > Without the change in equivclass.c, this query would trigger the new > added assert in get_baserel_parampathinfo for v16, and give a wrong plan > for v15. What do you think? I didn't add such a test because there are already several cases (in foreign_data.sql, IIRC) that trigger the assert, which is how come I found the problem in the first place. Admittedly, those depend on potentially-changeable details of an information_schema view, so maybe it'd be better to have a bespoke test. regards, tom lane