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 <[email protected]>
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(-)

Reply via email to