From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add ExplainState argument to pg_plan_query() and planner().
Date: Wed, 08 Oct 2025 12:41:26 +0000
Message-ID: <E1v6TTy-000fnV-1o@gemulon.postgresql.org> (raw)
Add ExplainState argument to pg_plan_query() and planner().
This allows extensions to have access to any data they've stored
in the ExplainState during planning. Unfortunately, it won't help
with EXPLAIN EXECUTE is used, but since that case is less common,
this still seems like an improvement.
Since planner() has quite a few arguments now, also add some
documentation of those arguments and the return value.
Author: Robert Haas <rhaas@postgresql.org>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: http://postgr.es/m/CA+TgmoYWKHU2hKr62Toyzh-kTDEnMDeLw7gkOOnjL-TnOUq0kQ@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c83ac02ec7309edb7561eee93895c31a54b93d3d
Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 14 ++++++-----
src/backend/commands/copyto.c | 2 +-
src/backend/commands/createas.c | 2 +-
src/backend/commands/explain.c | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/portalcmds.c | 3 ++-
src/backend/optimizer/plan/planner.c | 27 ++++++++++++++++++----
src/backend/tcop/postgres.c | 7 +++---
src/include/optimizer/optimizer.h | 5 +++-
src/include/optimizer/planner.h | 8 +++++--
src/include/tcop/tcopprot.h | 4 +++-
src/test/modules/delay_execution/delay_execution.c | 7 +++---
12 files changed, 58 insertions(+), 25 deletions(-)
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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: rhaas@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Add ExplainState argument to pg_plan_query() and planner().
In-Reply-To: <E1v6TTy-000fnV-1o@gemulon.postgresql.org>
* 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