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 1qc8Jw-00Dwnf-MV for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Sep 2023 17:52:36 +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 1qc8Jv-00GGQv-5e for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Sep 2023 17:52:34 +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 1qc8Ju-00GGQY-S2 for pgsql-hackers@lists.postgresql.org; Fri, 01 Sep 2023 17:52:34 +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 1qc8Jr-002CBa-Up for pgsql-hackers@lists.postgresql.org; Fri, 01 Sep 2023 17:52:33 +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 381HqTwI564721; Fri, 1 Sep 2023 13:52:29 -0400 From: Tom Lane To: Alvaro Herrera cc: Matthias van de Meent , PostgreSQL Hackers Subject: Re: GenBKI emits useless open;close for catalogs without rows In-reply-to: <20230901174330.6jbe4izkew4nlt7k@alvherre.pgsql> References: <20230901174330.6jbe4izkew4nlt7k@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Fri, 01 Sep 2023 19:43:30 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <564719.1693590749.1@sss.pgh.pa.us> Date: Fri, 01 Sep 2023 13:52:29 -0400 Message-ID: <564720.1693590749@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera writes: > On 2023-Sep-01, Matthias van de Meent wrote: >> A potential addition to the patch would to stop manually closing >> relations: initdb and check-world succeed without manual 'close' >> operations because the 'open' command auto-closes the previous open >> relation (in boot_openrel). Testing also suggests that the last opened >> relation apparently doesn't need closing - check-world succeeds >> without issues (incl. with TAP enabled). That is therefore implemented >> in attached patch 2 - it removes the 'close' syntax in its entirety. > Hmm, what happens with the last relation in the bootstrap process? Is > closerel() called via some other path for that one? Taking a quick census of existing closerel() callers: there is cleanup() in bootstrap.c, but it's called uncomfortably late and outside any transaction, so I misdoubt that it works properly if asked to actually shoulder any responsibility. (A little code reshuffling could fix that.) There are also a couple of low-level elog warnings in CREATE that would likely get triggered, though I suppose we could just remove those elogs. I guess my reaction to this patch is "why bother?". It seems unlikely to yield any measurable benefit, though of course that guess could be wrong. regards, tom lane