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.96) (envelope-from ) id 1wzwre-004M6D-2z for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Aug 2026 13:43:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wzwrd-007wLH-2i for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Aug 2026 13:43:25 +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.96) (envelope-from ) id 1wzwrd-007wL9-1l for pgsql-hackers@lists.postgresql.org; Fri, 28 Aug 2026 13:43:25 +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 1wzwrb-00000002qtN-3HZR for pgsql-hackers@lists.postgresql.org; Fri, 28 Aug 2026 13:43:24 +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 67SDhAw31147477; Fri, 28 Aug 2026 09:43:10 -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> Comments: In-reply-to Richard Guo message dated "Fri, 28 Aug 2026 16:29:08 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1147475.1787924590.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Fri, 28 Aug 2026 09:43:10 -0400 Message-ID: <1147476.1787924590@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, Aug 28, 2026 at 12:53 AM Tom Lane wrote: >> I take your point that the early-exit-for-trivial-jointree path now >> fails to set these fields at all, but I'd rather handle that by >> adding a couple more lines in that path to fill them in. Yup, it'd >> be duplicate logic, but it seems cleaner that way. > Fair enough. I agree that keeping all of this together at the end of > query_planner makes it clear that these fields are not valid before > then, and that a half-filled set during the restart loop is a hazard. > Adding the few lines to the early-exit path sounds good to me. Cool. >> Well, yeah, but on that argument we could drop the entire stanza, >> because it's just checking that join_is_removable didn't mess up. >> Maybe we should? I've not heard that anybody ever hit those Asserts. > I think so. Sold. I'll make it so and push. Thanks for reviewing! regards, tom lane