{"Entry":{"collection":"hook","key":"set_rel_pathlist_hook","name":"set_rel_pathlist_hook","aliases":[],"metadata":{"aliases":[],"category":"Query planning","content_hash":"f45e098d7bc0ff3b86847d5083bee675b8a9e0dbe644871ba054f56c18752ef3","derived_content_hash":"d786dc35886e948b9aaac0ae4f530819fb4acf7bfdb998b52a4433974747a880","imported_at":"2026-09-27T17:57:58.88876+08:00","name":"set_rel_pathlist_hook","name_zh":"set_rel_pathlist_hook","repair_provenance":{"original_source_revision":"","receipt_sha256":"c6fbbeab2b4f05674ed24a3e4d5aae1d65d95dad807f4c11b183fdb7a1a5c2a2","repair":"wiki-repair-20261023"},"slug":"set_rel_pathlist_hook","source_rev":"wiki-repair-20261023:af4abd44f9cad088c5e7ee5ec13093db1bf24cee424f76335aa7b6e347281307","summary":"Hook for plugins to get control in set_rel_pathlist()"}},"Definition":{"Collection":"hook","Key":"set_rel_pathlist_hook","SourceDatabase":"center","Version":"18","SourceTable":"hook","SourceKey":"set_rel_pathlist_hook","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","Facts":{"description":["Hook for plugins to get control in set_rel_pathlist()"],"description_zh":"供插件在 set_rel_pathlist() 中接管处理的钩子。","description_zh_html":"\u003cp\u003e供插件在 set_rel_pathlist() 中接管处理的钩子。\u003c/p\u003e\u003cp\u003e以下中文为本站依据所列 PostgreSQL 源码注释编译的说明。\u003c/p\u003e\u003ch3\u003e接口声明\u003c/h3\u003e\u003cpre\u003etypedef void (*set_rel_pathlist_hook_type) (PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTblEntry *rte);\nextern PGDLLIMPORT set_rel_pathlist_hook_type set_rel_pathlist_hook;\u003c/pre\u003e\u003ch3\u003e源码说明\u003c/h3\u003e\u003cp\u003e允许插件调整此基表关系的路径集合。插件可调用 add_path() 添加新路径（例如 CustomPaths）；若支持并行，则可调用 add_partial_path()。也可以删除或修改核心代码添加的路径。\u003c/p\u003e\u003ch3\u003e调用位置\u003c/h3\u003e\u003cul\u003e\u003cli\u003e\u003ccode\u003esrc/backend/optimizer/path/allpaths.c:543\u003c/code\u003e\u003c/li\u003e\u003c/ul\u003e\u003ch3\u003e核心调用上下文：src/backend/optimizer/path/allpaths.c:537–551\u003c/h3\u003e\u003cpre\u003e\t * Allow a plugin to editorialize on the set of Paths for this base\n\t * relation.  It could add new paths (such as CustomPaths) by calling\n\t * add_path(), or add_partial_path() if parallel aware.  It could also\n\t * delete or modify paths added by the core code.\n\t */\n\tif (set_rel_pathlist_hook)\n\t\t(*set_rel_pathlist_hook) (root, rel, rti, rte);\n\n\t/*\n\t * If this is a baserel, we should normally consider gathering any partial\n\t * paths we may have created for it.  We have to do this after calling the\n\t * set_rel_pathlist_hook, else it cannot add partial paths to be included\n\t * here.\n\t *\n\t * However, if this is an inheritance child, skip it.  Otherwise, we could\u003c/pre\u003e","facts":[{"label":"Interface type","value":"set_rel_pathlist_hook_type"},{"label":"Header","value":"src/include/optimizer/paths.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 set of Paths for this base relation. It could add new paths (such as CustomPaths) by calling add_path(), or add_partial_path() if parallel aware. It could also delete or modify paths added by the core code."],"title":"Core source comments"},{"paragraphs":["src/backend/optimizer/path/allpaths.c:543"],"title":"Call sites"},{"code":"\t * Allow a plugin to editorialize on the set of Paths for this base\n\t * relation.  It could add new paths (such as CustomPaths) by calling\n\t * add_path(), or add_partial_path() if parallel aware.  It could also\n\t * delete or modify paths added by the core code.\n\t */\n\tif (set_rel_pathlist_hook)\n\t\t(*set_rel_pathlist_hook) (root, rel, rti, rte);\n\n\t/*\n\t * If this is a baserel, we should normally consider gathering any partial\n\t * paths we may have created for it.  We have to do this after calling the\n\t * set_rel_pathlist_hook, else it cannot add partial paths to be included\n\t * here.\n\t *\n\t * However, if this is an inheritance child, skip it.  Otherwise, we could","paragraphs":[],"title":"Core call context: src/backend/optimizer/path/allpaths.c:537–551"}],"signature":"typedef void (*set_rel_pathlist_hook_type) (PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTblEntry *rte);\nextern PGDLLIMPORT set_rel_pathlist_hook_type set_rel_pathlist_hook;","sources":[{"label":"Interface declaration","path":"src/include/optimizer/paths.h","sha256":"bf497b2e5501e7c86250147c9cc779785ccec7bb2a806d3c71571313e890208f","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/optimizer/paths.h#L30"},{"label":"Core definition","path":"src/backend/optimizer/path/allpaths.c","sha256":"285b61d146f1e7324a43d7d408ca8d6f10ad3de7eaba01c9f1d618417c21392d","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/optimizer/path/allpaths.c#L85"},{"label":"Call sites","path":"src/backend/optimizer/path/allpaths.c","sha256":"285b61d146f1e7324a43d7d408ca8d6f10ad3de7eaba01c9f1d618417c21392d","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/optimizer/path/allpaths.c#L543"}],"translation_provenance":{"inputs":[{"label":"Interface declaration","path":"src/include/optimizer/paths.h","sha256":"bf497b2e5501e7c86250147c9cc779785ccec7bb2a806d3c71571313e890208f","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/optimizer/paths.h#L30"},{"label":"Core definition","path":"src/backend/optimizer/path/allpaths.c","sha256":"285b61d146f1e7324a43d7d408ca8d6f10ad3de7eaba01c9f1d618417c21392d","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/optimizer/path/allpaths.c#L85"},{"label":"Call sites","path":"src/backend/optimizer/path/allpaths.c","sha256":"285b61d146f1e7324a43d7d408ca8d6f10ad3de7eaba01c9f1d618417c21392d","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/optimizer/path/allpaths.c#L543"}],"kind":"authored-source-translation","locale":"zh-Hans","source_revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","translated_source_sha256":"1f4148c5c07af7d0a9ac13c13d04f664ac9bfac96b2cc107abe65caa55e158e9","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/paths.h","sha256":"bf497b2e5501e7c86250147c9cc779785ccec7bb2a806d3c71571313e890208f","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/optimizer/paths.h#L30"},{"label":"Core definition","path":"src/backend/optimizer/path/allpaths.c","sha256":"285b61d146f1e7324a43d7d408ca8d6f10ad3de7eaba01c9f1d618417c21392d","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/optimizer/path/allpaths.c#L85"},{"label":"Call sites","path":"src/backend/optimizer/path/allpaths.c","sha256":"285b61d146f1e7324a43d7d408ca8d6f10ad3de7eaba01c9f1d618417c21392d","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/optimizer/path/allpaths.c#L543"}]},"MeasuredEvidence":{}},"Text":{"Collection":"hook","Key":"set_rel_pathlist_hook","SourceDatabase":"center","Version":"18","Locale":"en","Title":"set_rel_pathlist_hook","Summary":"Hook for plugins to get control in set_rel_pathlist()","BodyHTML":"\u003cp\u003eHook for plugins to get control in set_rel_pathlist()\u003c/p\u003e","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","ContentHash":"5cc2dfcc06f451c97d65496ee0a095e028087aa489a9d7082526e996c961a437","Payload":{"description":["Hook for plugins to get control in set_rel_pathlist()"],"related":[{"label":"The Planner/Optimizer","url":"/docs/18/planner-optimizer.html"}],"sections":[{"paragraphs":["Allow a plugin to editorialize on the set of Paths for this base relation. It could add new paths (such as CustomPaths) by calling add_path(), or add_partial_path() if parallel aware. It could also delete or modify paths added by the core code."],"title":"Core source comments"},{"paragraphs":["src/backend/optimizer/path/allpaths.c:543"],"title":"Call sites"},{"code":"\t * Allow a plugin to editorialize on the set of Paths for this base\n\t * relation.  It could add new paths (such as CustomPaths) by calling\n\t * add_path(), or add_partial_path() if parallel aware.  It could also\n\t * delete or modify paths added by the core code.\n\t */\n\tif (set_rel_pathlist_hook)\n\t\t(*set_rel_pathlist_hook) (root, rel, rti, rte);\n\n\t/*\n\t * If this is a baserel, we should normally consider gathering any partial\n\t * paths we may have created for it.  We have to do this after calling the\n\t * set_rel_pathlist_hook, else it cannot add partial paths to be included\n\t * here.\n\t *\n\t * However, if this is an inheritance child, skip it.  Otherwise, we could","paragraphs":[],"title":"Core call context: src/backend/optimizer/path/allpaths.c:537–551"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
