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 1tpwSI-00EYr2-Q2 for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Mar 2025 21:39:06 +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 1tpwSH-006Sgx-3k for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Mar 2025 21:39:05 +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 1tpwSG-006SeP-PQ for pgsql-hackers@lists.postgresql.org; Wed, 05 Mar 2025 21:39:04 +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.96) (envelope-from ) id 1tpwSE-001B4e-34 for pgsql-hackers@lists.postgresql.org; Wed, 05 Mar 2025 21:39:03 +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 525LcumL480079; Wed, 5 Mar 2025 16:38:56 -0500 From: Tom Lane To: Robert Haas cc: Jeff Davis , Thom Brown , PostgreSQL Hackers Subject: Re: making EXPLAIN extensible In-reply-to: References: <5bbca514250c1f8ee45f08ada94184b0ae109fe9.camel@j-davis.com> <82f96eed213c8d76b36b8a3f504576e5af493270.camel@j-davis.com> <339167.1741200807@sss.pgh.pa.us> <476382.1741208421@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Wed, 05 Mar 2025 16:13:06 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <480077.1741210736.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Wed, 05 Mar 2025 16:38:56 -0500 Message-ID: <480078.1741210736@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > On Wed, Mar 5, 2025 at 4:00 PM Tom Lane wrote: >> Got it. So does that mean we can remove any #include's from explain.h >> after moving the struct definition? > Good question. It looks like "lib/stringinfo.h" can come out but the > other two are still needed, so there is not much gain. But I've made > that change in the attached v4. OK. v4 has addressed most of my nitpicks, but you still have typedefs for ExplainState in both header files. My bet is that at least one buildfarm animal will complain about that. I could be wrong though, maybe all such compilers are in disuse now. Also I noted one more nitpick: I think SetExplainExtensionState needs to grow the array with repalloc0 not repalloc, else you risk GetExplainExtensionState returning garbage pointers for not-yet-set array entries. In perhaps-less-nitpicky territory, I wonder how well the "per backend" notion of extension and option IDs plays with extensions that assign those during _PG_init, as I see you've done in 0003. What I'm concerned about is what happens when the extension is loaded using shared_preload_libraries. I think what will happen is (1) IDs will be assigned in the postmaster, and nothing bad happens as long as TopMemoryContext already exists, which it will. (2) Such IDs propagate to backends via fork(), and thus are effectively system-wide. (3) But ... in an EXEC_BACKEND build, it doesn't work like that. Child processes will repeat the postmaster's processing of shared_preload_libraries. Probably they will load the modules in the same order and get the same ID assignments, but I'm not quite sure that's guaranteed. In short, I wonder if somebody might build code that depends on the IDs being the same across a cluster, and find that it mostly works but sometimes not on Windows. Maybe we don't care given that we explicitly disclaimed them being the same. But it's probably worth a bit of thought. regards, tom lane