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.98.2) (envelope-from ) id 1x72EK-000000003my-2lTc for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Sep 2026 02:52:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1x72EJ-00000001cH1-2b4C for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Sep 2026 02:52:07 +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.98.2) (envelope-from ) id 1x72EJ-00000001cGt-1QJO for pgsql-hackers@lists.postgresql.org; Thu, 17 Sep 2026 02:52:07 +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.98.2) (envelope-from ) id 1x72EH-000000003Ps-37Uu for pgsql-hackers@lists.postgresql.org; Thu, 17 Sep 2026 02:52:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 68H2pxHE598916; Wed, 16 Sep 2026 22:51:59 -0400 From: Tom Lane To: Richard Guo cc: Thom Brown , Jacob Brazeal , pgsql-hackers@lists.postgresql.org Subject: Re: remove_useless_joins vs. bug #19560 In-reply-to: References: <1186816.1784573544@sss.pgh.pa.us> <2727652.1784997994@sss.pgh.pa.us> <2746010.1785014587@sss.pgh.pa.us> <2933135.1785032128@sss.pgh.pa.us> <3304318.1785087206@sss.pgh.pa.us> <3304418.1785087314@sss.pgh.pa.us> <3968565.1785170019@sss.pgh.pa.us> <3975112.1785176472@sss.pgh.pa.us> <670538.1786924698@sss.pgh.pa.us> <839346.1787765112@sss.pgh.pa.us> <954541.1787846010@sss.pgh.pa.us> <1147476.1787924590@sss.pgh.pa.us> Comments: In-reply-to Richard Guo message dated "Thu, 17 Sep 2026 11:40:57 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <598914.1789613519.1@sss.pgh.pa.us> Date: Wed, 16 Sep 2026 22:51:59 -0400 Message-ID: <598915.1789613519@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > Fuzzing with Claude, I ran into an assertion failure that comes from > commit 2ebf25e7d: > create table t1 (a int, b int, c int); > create table t2 (a int primary key, b int, c int); > select j.x from (t1 s(x) left join t2 on s.x = t2.a) j; > server closed the connection unexpectedly Ugh. > I think this varnosyn is fine to keep. The join is only removed from > the jointree; its RTE stays in the rangetable through to the final > plan, so varnosyn still names a valid RTE. And join removal didn't > touch varnosyn before 2ebf25e7d either. True. > Attached is a fix. The main consumer of varnosyn is ruleutils.c, so I don't like the fact that this test case isn't showing what ruleutils will do with the Var. If we make it be "explain verbose", do we get a display of the problematic Var? regards, tom lane