From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Jeff Davis <pgsql@j-davis.com>
Cc: Thom Brown <thom@linux.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: making EXPLAIN extensible
Date: Wed, 05 Mar 2025 16:38:56 -0500
Message-ID: <480078.1741210736@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoZR-j1nqc9uz-9SMb2BecM-_bz4btixJ2X=9JCaCuEWEQ@mail.gmail.com>
References: <CA+TgmoYSzg58hPuBmei46o8D3SKX+SZoO4K_aGQGwiRzvRApLg@mail.gmail.com>
<CAA-aLv4MDS2aQLR9v5xgg9qiN7z_YrbcYf-FGWVCN=Jv_Psppg@mail.gmail.com>
<CA+TgmoYf6JtCdYJ0Q4WgC-B9t07JTAH9MEMxX4_riuXvjM8ETQ@mail.gmail.com>
<5bbca514250c1f8ee45f08ada94184b0ae109fe9.camel@j-davis.com>
<CA+TgmoaE=7QGjWoWoi19gdF90YO1a0tq1-iyWVAhj82BMPnJSg@mail.gmail.com>
<82f96eed213c8d76b36b8a3f504576e5af493270.camel@j-davis.com>
<CA+TgmobPz9phD5PpXeUNTSrkc9uXkRg6Gfq6gPatpA-XTaQCcw@mail.gmail.com>
<339167.1741200807@sss.pgh.pa.us>
<CA+TgmobpP-7yOT-vdOFKFZoxe_z_36tgzorGyuF8wtZvZRtV8Q@mail.gmail.com>
<476382.1741208421@sss.pgh.pa.us>
<CA+TgmoZR-j1nqc9uz-9SMb2BecM-_bz4btixJ2X=9JCaCuEWEQ@mail.gmail.com>
Robert Haas <robertmhaas@gmail.com> writes:
> On Wed, Mar 5, 2025 at 4:00 PM Tom Lane <tgl@sss.pgh.pa.us> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, pgsql@j-davis.com, thom@linux.com
Subject: Re: making EXPLAIN extensible
In-Reply-To: <480078.1741210736@sss.pgh.pa.us>
References: <CA+TgmoYSzg58hPuBmei46o8D3SKX+SZoO4K_aGQGwiRzvRApLg@mail.gmail.com> <CAA-aLv4MDS2aQLR9v5xgg9qiN7z_YrbcYf-FGWVCN=Jv_Psppg@mail.gmail.com> <CA+TgmoYf6JtCdYJ0Q4WgC-B9t07JTAH9MEMxX4_riuXvjM8ETQ@mail.gmail.com> <5bbca514250c1f8ee45f08ada94184b0ae109fe9.camel@j-davis.com> <CA+TgmoaE=7QGjWoWoi19gdF90YO1a0tq1-iyWVAhj82BMPnJSg@mail.gmail.com> <82f96eed213c8d76b36b8a3f504576e5af493270.camel@j-davis.com> <CA+TgmobPz9phD5PpXeUNTSrkc9uXkRg6Gfq6gPatpA-XTaQCcw@mail.gmail.com> <339167.1741200807@sss.pgh.pa.us> <CA+TgmobpP-7yOT-vdOFKFZoxe_z_36tgzorGyuF8wtZvZRtV8Q@mail.gmail.com> <476382.1741208421@sss.pgh.pa.us> <CA+TgmoZR-j1nqc9uz-9SMb2BecM-_bz4btixJ2X=9JCaCuEWEQ@mail.gmail.com> <480078.1741210736@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox