pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Replace get_relation_info_hook with build_simple_rel_hook.
Date: Mon, 09 Mar 2026 13:49:25 +0000
Message-ID: <E1vzaz7-0039oq-2A@gemulon.postgresql.org> (raw)

Replace get_relation_info_hook with build_simple_rel_hook.

For a long time, PostgreSQL has had a get_relation_info_hook which
plugins can use to editorialize on the information that
get_relation_info obtains from the catalogs. However, this hook is
only called for baserels of type RTE_RELATION, and there is
potential utility in a similar call back for other types of
RTEs. This might have had utility even before commit
4020b370f214315b8c10430301898ac21658143f added pgs_mask to
RelOptInfo, but it certainly has utility now.

So, move the callback up one level, deleting get_relation_info_hook and
adding build_simple_rel_hook instead. The new callback is called just
slightly later than before and with slightly different arguments, but it
should be fairly straightforward to adjust existing code that currently
uses get_relation_info_hook: the values previously available as
relationObjectId and inhparent are now available via rte->relid and
rte->inh, and calls where rte->rtekind != RTE_RELATION can be ignored if
desired.

Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>
Discussion: http://postgr.es/m/CA%2BTgmoYg8uUWyco7Pb3HYLMBRQoO6Zh9hwgm27V39Pb6Pdf%3Dug%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/91f33a2ae92a68ac89b36eb21e0c5c903d03a142

Modified Files
--------------
src/backend/optimizer/util/plancat.c | 14 --------------
src/backend/optimizer/util/relnode.c | 15 +++++++++++++++
src/include/optimizer/pathnode.h     |  6 ++++++
src/include/optimizer/plancat.h      |  8 --------
4 files changed, 21 insertions(+), 22 deletions(-)



Message-ID: <E1vzaz7-0039oq-2A@gemulon.postgresql.org>
Permalink:  ../E1vzaz7-0039oq-2A@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vzaz7-0039oq-2A@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: rhaas@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Replace get_relation_info_hook with build_simple_rel_hook.
  In-Reply-To: <E1vzaz7-0039oq-2A@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