↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / Hooks / Query planning

get_relation_info_hook

get_relation_info_hook

Hook for plugins to get control in get_relation_info()

Reading PostgreSQL 18.

Description

Hook for plugins to get control in get_relation_info()

Interface type
get_relation_info_hook_type
Header
src/include/optimizer/plancat.h
Subsystem
Query planning
Initial value
NULL (no hook installed)

C interface

typedef void (*get_relation_info_hook_type) (PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel);
extern PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook;

Core source comments

Allow a plugin to editorialize on the info we obtained from the catalogs. Actions might include altering the assumed relation size, removing an index, or adding a hypothetical index to the indexlist.

Call sites

src/backend/optimizer/util/plancat.c:575

Core call context: src/backend/optimizer/util/plancat.c:569–583

	/*
	 * Allow a plugin to editorialize on the info we obtained from the
	 * catalogs.  Actions might include altering the assumed relation size,
	 * removing an index, or adding a hypothetical index to the indexlist.
	 */
	if (get_relation_info_hook)
		(*get_relation_info_hook) (root, relationObjectId, inhparent, rel);
}

/*
 * get_relation_foreign_keys -
 *	  Retrieves foreign key information for a given relation.
 *
 * ForeignKeyOptInfos for relevant foreign keys are created and added to
 * root->fkey_list.  We do this now while we have the relcache entry open.

Related entries

Documentation and source

Source build
Version
18
Build
REL_18_STABLE
Source fingerprint
753057e340da8f22e57c9a409ea7a235fd6a46bd

Compare versions

PostgreSQL 18 → 19: removed.

--- PostgreSQL 18
+++ PostgreSQL 19
@@ -1,22 +1 @@
-{
-  "facts": [
-    {
-      "label": "Interface type",
-      "value": "get_relation_info_hook_type"
-    },
-    {
-      "label": "Header",
-      "value": "src/include/optimizer/plancat.h"
-    },
-    {
-      "label": "Subsystem",
-      "value": "Query planning"
-    },
-    {
-      "label": "Initial value",
-      "value": "NULL (no hook installed)"
-    }
-  ],
-  "signature": "typedef void (*get_relation_info_hook_type) (PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel);\nextern PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook;",
-  "tables": null
-}
+Not recorded in this version

Compares recorded interfaces and attributes. Source fingerprints and build metadata are excluded; an absent sample is not proof of the introduction or removal release.

Related entries

Export JSON · Back to Hooks · Recorded in PostgreSQL 10 through 18; the first sample is not necessarily its introduction.