{"Entry":{"collection":"hook","key":"get_relation_info_hook","name":"get_relation_info_hook","aliases":[],"metadata":{"aliases":[],"category":"Query planning","content_hash":"e08e1ee8e7cc59ef978204e0b128c8a15c24cb44f4ecdd91cf81cdf202539417","derived_content_hash":"3ec0c542dd55c1a5d727b5d571f2807de481b51dc8520f27461ef961eb75044f","imported_at":"2026-09-27T17:57:58.873069+08:00","name":"get_relation_info_hook","name_zh":"get_relation_info_hook","repair_provenance":{"original_source_revision":"","receipt_sha256":"2d66c04511956d22bf9ee3264d5830d603930c4adbde89a92d1b6578143c2405","repair":"wiki-repair-20261023"},"slug":"get_relation_info_hook","source_rev":"wiki-repair-20261023:c69285c9ece93662e4febc7da2c4cfb391b519f9f30eb6722007e98f89bebbe4","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()"],"description_zh":"供插件在 get_relation_info() 中接管处理的钩子。","description_zh_html":"\u003cp\u003e供插件在 get_relation_info() 中接管处理的钩子。\u003c/p\u003e\u003cp\u003e以下中文为本站依据所列 PostgreSQL 源码注释编译的说明。\u003c/p\u003e\u003ch3\u003e接口声明\u003c/h3\u003e\u003cpre\u003etypedef 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;\u003c/pre\u003e\u003ch3\u003e源码说明\u003c/h3\u003e\u003cp\u003e允许插件调整从系统目录取得的信息，例如改变假定的关系大小、移除索引，或向 indexlist 加入假想索引。\u003c/p\u003e\u003ch3\u003e调用位置\u003c/h3\u003e\u003cul\u003e\u003cli\u003e\u003ccode\u003esrc/backend/optimizer/util/plancat.c:575\u003c/code\u003e\u003c/li\u003e\u003c/ul\u003e\u003ch3\u003e核心调用上下文：src/backend/optimizer/util/plancat.c:569–583\u003c/h3\u003e\u003cpre\u003e\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-\u0026gt;fkey_list.  We do this now while we have the relcache entry open.\u003c/pre\u003e","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"}],"translation_provenance":{"inputs":[{"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"}],"kind":"authored-source-translation","locale":"zh-Hans","source_revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","translated_source_sha256":"85c32e99d76de6104ae1e2f4bfbb1027b5d962f2494b566146446462dd603123","version":"18"},"zh_from":"authored-source-translation"},"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":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
