Re: RFC: extensible planner state

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: RFC: extensible planner state
Date: 2025-09-24 16:02:58
Message-ID: CA+TgmobhJ51sK7-JVMDFm1UT51Cik=fMXT04=0neT=oOQp7c9A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 22, 2025 at 3:51 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I looked through the v5 patchset.

Thanks!

Here's a new set of patches. I've added a new 0001 at the beginning to
fix the bug you identified in SetExplainExtensionState; this will need
to be back-patched to v18 once the release freeze lifts. I've also
adjusted the previous patch, now 0002, to fix the equivalent problem
with the new Set*ExplainState functions,and I've attempted to fix the
other problems you mentioned, with this exception:

> Also, although you're not the first sinner, I really think
> this new argument to planner() should be documented. Maybe
> the rest too while we're at it.

I'm a little nervous about this. I fear that the comments are all
going to be of the form "to save a file, click the File menu, then
click Save," which doesn't actually help anyone. That might be a
slight exaggeration, but I feel like it's pretty obvious on visual
inspection that Query *parse is what we're planning, char
*query_string is the text version of that, cursorOptions is some kind
of flag mask, boundParams is the parameter values. It's fair to say
that ExplainState *es is a little less obvious than the others, but
saying "If this function is being invoked by EXPLAIN, then
ExplainState *es is the ExplainState, else it is NULL" doesn't really
seem all that helpful to me. I mean, what else would it be? My thought
here would be that if you want to write some comments that you
consider helpful for the existing arguments, I'll try to write a new
comment for this one in the same style (or you can suggest one) and
hold my nose if I don't find it helpful, or alternatively, we could
proceed with these patches without the comment and you can add
whatever comment text you want after-the-fact. If you want the comment
changes in this patch set, then I need a suggestion as to what that
should look like.

--
Robert Haas
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
v6-0001-Fix-array-allocation-bugs-in-SetExplainExtensionS.patch application/octet-stream 1.7 KB
v6-0002-Allow-private-state-in-certain-planner-data-struc.patch application/octet-stream 10.8 KB
v6-0003-Remove-PlannerInfo-s-join_search_private-method.patch application/octet-stream 8.6 KB
v6-0004-Add-ExplainState-argument-to-pg_plan_query-and-pl.patch application/octet-stream 12.2 KB
v6-0005-Add-planner_setup_hook-and-planner_shutdown_hook.patch application/octet-stream 3.4 KB
v6-0006-Add-extension_state-member-to-PlannedStmt.patch application/octet-stream 1.3 KB
v6-0007-not-for-commit-count-distinct-joinrels-and-joinre.patch application/octet-stream 8.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-09-24 16:13:34 Re: Clarification on Role Access Rights to Table Indexes
Previous Message Nathan Bossart 2025-09-24 15:58:25 Re: Clarification on Role Access Rights to Table Indexes