pgsql: Make it possible for loadable modules to add EXPLAIN options.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make it possible for loadable modules to add EXPLAIN options.
Date: 2025-03-18 12:56:08
Message-ID: E1tuWUK-0035rm-0m@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make it possible for loadable modules to add EXPLAIN options.

Modules can use RegisterExtensionExplainOption to register new
EXPLAIN options, and GetExplainExtensionId, GetExplainExtensionState,
and SetExplainExtensionState to store related state inside the
ExplainState object.

Since this substantially increases the amount of code that needs
to handle ExplainState-related tasks, move a few bits of existing
code to a new file explain_state.c and add the rest of this
infrastructure there.

See the comments at the top of explain_state.c for further
explanation of how this mechanism works.

This does not yet provide a way for such such options to do anything
useful. The intention is that we'll add hooks for that purpose in a
separate commit.

Discussion: http://postgr.es/m/CA+TgmoYSzg58hPuBmei46o8D3SKX+SZoO4K_aGQGwiRzvRApLg@mail.gmail.com
Reviewed-by: Srinath Reddy <srinath2133(at)gmail(dot)com>
Reviewed-by: Andrei Lepikhov <lepihov(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Sami Imseih <samimseih(at)gmail(dot)com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c65bc2e1d14a2d4daed7c1921ac518f2c5ac3d17

Modified Files
--------------
contrib/auto_explain/auto_explain.c | 1 +
contrib/file_fdw/file_fdw.c | 3 +-
contrib/postgres_fdw/postgres_fdw.c | 2 +-
src/backend/commands/Makefile | 1 +
src/backend/commands/createas.c | 2 +
src/backend/commands/explain.c | 143 +------------
src/backend/commands/explain_dr.c | 1 +
src/backend/commands/explain_format.c | 1 +
src/backend/commands/explain_state.c | 371 ++++++++++++++++++++++++++++++++++
src/backend/commands/meson.build | 1 +
src/backend/commands/prepare.c | 2 +
src/backend/executor/execAmi.c | 1 +
src/backend/tcop/pquery.c | 1 +
src/include/commands/explain.h | 80 ++------
src/include/commands/explain_state.h | 95 +++++++++
src/include/commands/prepare.h | 3 +-
src/include/nodes/extensible.h | 2 +-
src/tools/pgindent/typedefs.list | 2 +
18 files changed, 503 insertions(+), 209 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2025-03-18 13:03:32 pgsql: Fix indentation again.
Previous Message Robert Haas 2025-03-18 12:28:25 Re: pgsql: pg_upgrade: Preserve default char signedness value from old clus