pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Rename CachedPlanType to PlannedStmtOrigin for PlannedStmt
Date: Thu, 31 Jul 2025 01:06:48 +0000
Message-ID: <E1uhHku-001Zmo-1n@gemulon.postgresql.org> (raw)

Rename CachedPlanType to PlannedStmtOrigin for PlannedStmt

Commit 719dcf3c42 introduced a field called CachedPlanType in
PlannedStmt to allow extensions to determine whether a cached plan is
generic or custom.

After discussion, the concepts that we want to track are a bit wider
than initially anticipated, as it is closer to knowing from which
"source" or "origin" a PlannedStmt has been generated or retrieved.
Custom and generic cached plans are a subset of that.

Based on the state of HEAD, we have been able to define two more
origins:
- "standard", for the case where PlannedStmt is generated in
standard_planner(), the most common case.
- "internal", for the fake PlannedStmt generated internally by some
query patterns.

This could be tuned in the future depending on what is needed.  This
looks like a good starting point, at least.  The default value is called
"UNKNOWN", provided as fallback value.  This value is not used in the
core code, the idea is to let extensions building their own PlannedStmts
know about this new field.

Author: Michael Paquier <michael@paquier.xyz>
Co-authored-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/aILaHupXbIGgF2wJ@paquier.xyz

Branch
------
master

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

Modified Files
--------------
src/backend/commands/foreigncmds.c   |  2 +-
src/backend/commands/schemacmds.c    |  2 +-
src/backend/executor/execParallel.c  |  2 +-
src/backend/optimizer/plan/planner.c |  2 +-
src/backend/tcop/postgres.c          |  2 +-
src/backend/tcop/utility.c           |  4 ++--
src/backend/utils/cache/plancache.c  |  2 +-
src/include/nodes/plannodes.h        | 21 +++++++++++----------
src/tools/pgindent/typedefs.list     |  2 +-
9 files changed, 20 insertions(+), 19 deletions(-)



Message-ID: <E1uhHku-001Zmo-1n@gemulon.postgresql.org>
Permalink:  ../E1uhHku-001Zmo-1n@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uhHku-001Zmo-1n@gemulon.postgresql.org

 · 

reply

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: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Rename CachedPlanType to PlannedStmtOrigin for PlannedStmt
  In-Reply-To: <E1uhHku-001Zmo-1n@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