{"Entry":{"collection":"hook","key":"get_relation_info_hook","name":"get_relation_info_hook","aliases":[],"metadata":{"aliases":[],"category":"Query planning","content_hash":"e08e1ee8e7cc59ef978204e0b128c8a15c24cb44f4ecdd91cf81cdf202539417","imported_at":"2026-09-27T17:57:58.873069+08:00","name":"get_relation_info_hook","name_zh":"get_relation_info_hook","slug":"get_relation_info_hook","summary":"Hook for plugins to get control in get_relation_info()"}},"Definition":{"Collection":"hook","Key":"get_relation_info_hook","SourceDatabase":"center","Version":"18","SourceTable":"hook","SourceKey":"get_relation_info_hook","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","Facts":{"description":["Hook for plugins to get control in get_relation_info()"],"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)"}],"related":[{"label":"The Planner/Optimizer","url":"/docs/18/planner-optimizer.html"}],"release":{"channel":"stable","label":"18","major":"18","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd"},"sections":[{"paragraphs":["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."],"title":"Core source comments"},{"paragraphs":["src/backend/optimizer/util/plancat.c:575"],"title":"Call sites"},{"code":"\t/*\n\t * Allow a plugin to editorialize on the info we obtained from the\n\t * catalogs.  Actions might include altering the assumed relation size,\n\t * removing an index, or adding a hypothetical index to the indexlist.\n\t */\n\tif (get_relation_info_hook)\n\t\t(*get_relation_info_hook) (root, relationObjectId, inhparent, rel);\n}\n\n/*\n * get_relation_foreign_keys -\n *\t  Retrieves foreign key information for a given relation.\n *\n * ForeignKeyOptInfos for relevant foreign keys are created and added to\n * root-\u003efkey_list.  We do this now while we have the relcache entry open.","paragraphs":[],"title":"Core call context: src/backend/optimizer/util/plancat.c:569–583"}],"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;","sources":[{"label":"Interface declaration","path":"src/include/optimizer/plancat.h","sha256":"b5e344f3c4b57ff2f7c3f6827a4778bb781c94f4ff1cb3af516141bff8f2be89","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/optimizer/plancat.h#L21"},{"label":"Core definition","path":"src/backend/optimizer/util/plancat.c","sha256":"b953af14cb2539fbb32e4d1e8eea30f3eaa1b6336091369c03531fb9dcd5a6ff","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/optimizer/util/plancat.c#L61"},{"label":"Call sites","path":"src/backend/optimizer/util/plancat.c","sha256":"b953af14cb2539fbb32e4d1e8eea30f3eaa1b6336091369c03531fb9dcd5a6ff","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/optimizer/util/plancat.c#L575"}]},"ManualEvidence":{"release":{"channel":"stable","label":"18","major":"18","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd"},"sources":[{"label":"Interface declaration","path":"src/include/optimizer/plancat.h","sha256":"b5e344f3c4b57ff2f7c3f6827a4778bb781c94f4ff1cb3af516141bff8f2be89","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/optimizer/plancat.h#L21"},{"label":"Core definition","path":"src/backend/optimizer/util/plancat.c","sha256":"b953af14cb2539fbb32e4d1e8eea30f3eaa1b6336091369c03531fb9dcd5a6ff","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/optimizer/util/plancat.c#L61"},{"label":"Call sites","path":"src/backend/optimizer/util/plancat.c","sha256":"b953af14cb2539fbb32e4d1e8eea30f3eaa1b6336091369c03531fb9dcd5a6ff","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/optimizer/util/plancat.c#L575"}]},"MeasuredEvidence":{}},"Text":{"Collection":"hook","Key":"get_relation_info_hook","SourceDatabase":"center","Version":"18","Locale":"en","Title":"get_relation_info_hook","Summary":"Hook for plugins to get control in get_relation_info()","BodyHTML":"\u003cp\u003eHook for plugins to get control in get_relation_info()\u003c/p\u003e","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","ContentHash":"36753a0df58042378178c68c9f0108de2a45647eee683d9cc31d909241ff88ff","Payload":{"description":["Hook for plugins to get control in get_relation_info()"],"related":[{"label":"The Planner/Optimizer","url":"/docs/18/planner-optimizer.html"}],"sections":[{"paragraphs":["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."],"title":"Core source comments"},{"paragraphs":["src/backend/optimizer/util/plancat.c:575"],"title":"Call sites"},{"code":"\t/*\n\t * Allow a plugin to editorialize on the info we obtained from the\n\t * catalogs.  Actions might include altering the assumed relation size,\n\t * removing an index, or adding a hypothetical index to the indexlist.\n\t */\n\tif (get_relation_info_hook)\n\t\t(*get_relation_info_hook) (root, relationObjectId, inhparent, rel);\n}\n\n/*\n * get_relation_foreign_keys -\n *\t  Retrieves foreign key information for a given relation.\n *\n * ForeignKeyOptInfos for relevant foreign keys are created and added to\n * root-\u003efkey_list.  We do this now while we have the relcache entry open.","paragraphs":[],"title":"Core call context: src/backend/optimizer/util/plancat.c:569–583"}]}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
