{"Entry":{"collection":"hook","key":"executorstart_hook","name":"ExecutorStart_hook","aliases":[],"metadata":{"aliases":[],"category":"Query execution","content_hash":"8493211083311c9fcee5c856c2084d9154ee7c6b52b8acccfb629df9a6a09009","derived_content_hash":"89a27b236e4b0a504bc81c1fe12cead3b9779b74c900d24f9f339341be753cc9","imported_at":"2026-09-27T17:57:58.866209+08:00","name":"ExecutorStart_hook","name_zh":"ExecutorStart_hook","repair_provenance":{"original_source_revision":"","receipt_sha256":"446ab5e4398d34a66c3a9df9f705fd2a3b5dd1046129d90af8fd6e61d7fd85c8","repair":"wiki-repair-20261023"},"slug":"executorstart_hook","source_rev":"wiki-repair-20261023:d2d351adbb88600d32855fd6e9deea8e48808d7cb07222276f693b61e9618734","summary":"Hook for plugins to get control in ExecutorStart()"}},"Definition":{"Collection":"hook","Key":"executorstart_hook","SourceDatabase":"center","Version":"18","SourceTable":"hook","SourceKey":"executorstart_hook","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","Facts":{"description":["Hook for plugins to get control in ExecutorStart()"],"description_zh":"供插件在 ExecutorStart() 中接管处理的钩子。","description_zh_html":"\u003cp\u003e供插件在 ExecutorStart() 中接管处理的钩子。\u003c/p\u003e\u003cp\u003e以下中文为本站依据所列 PostgreSQL 源码注释编译的说明。\u003c/p\u003e\u003ch3\u003e接口声明\u003c/h3\u003e\u003cpre\u003etypedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags);\nextern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook;\u003c/pre\u003e\u003ch3\u003e源码说明\u003c/h3\u003e\u003cp\u003e供插件在 ExecutorStart、ExecutorRun、ExecutorFinish 和 ExecutorEnd 中接管处理的钩子。\u003c/p\u003e\u003ch3\u003e调用位置\u003c/h3\u003e\u003cul\u003e\u003cli\u003e\u003ccode\u003esrc/backend/executor/execMain.c:135\u003c/code\u003e\u003c/li\u003e\u003c/ul\u003e\u003ch3\u003e核心调用上下文：src/backend/executor/execMain.c:129–143\u003c/h3\u003e\u003cpre\u003e\t * call will be ignored if the top level query_id has already been\n\t * reported.\n\t */\n\tpgstat_report_query_id(queryDesc-\u0026gt;plannedstmt-\u0026gt;queryId, false);\n\n\tif (ExecutorStart_hook)\n\t\t(*ExecutorStart_hook) (queryDesc, eflags);\n\telse\n\t\tstandard_ExecutorStart(queryDesc, eflags);\n}\n\nvoid\nstandard_ExecutorStart(QueryDesc *queryDesc, int eflags)\n{\n\tEState\t   *estate;\u003c/pre\u003e","facts":[{"label":"Interface type","value":"ExecutorStart_hook_type"},{"label":"Header","value":"src/include/executor/executor.h"},{"label":"Subsystem","value":"Query execution"},{"label":"Initial value","value":"NULL (no hook installed)"}],"related":[{"label":"The Executor","url":"/docs/18/executor.html"}],"release":{"channel":"stable","label":"18","major":"18","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd"},"sections":[{"paragraphs":["Hooks for plugins to get control in ExecutorStart/Run/Finish/End"],"title":"Core source comments"},{"paragraphs":["src/backend/executor/execMain.c:135"],"title":"Call sites"},{"code":"\t * call will be ignored if the top level query_id has already been\n\t * reported.\n\t */\n\tpgstat_report_query_id(queryDesc-\u003eplannedstmt-\u003equeryId, false);\n\n\tif (ExecutorStart_hook)\n\t\t(*ExecutorStart_hook) (queryDesc, eflags);\n\telse\n\t\tstandard_ExecutorStart(queryDesc, eflags);\n}\n\nvoid\nstandard_ExecutorStart(QueryDesc *queryDesc, int eflags)\n{\n\tEState\t   *estate;","paragraphs":[],"title":"Core call context: src/backend/executor/execMain.c:129–143"}],"signature":"typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags);\nextern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook;","sources":[{"label":"Interface declaration","path":"src/include/executor/executor.h","sha256":"65710b17bb91a8fe6367654bb27b67ef7a7c238f79ba46248f92a3b8302cd4bb","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/executor/executor.h#L75"},{"label":"Core definition","path":"src/backend/executor/execMain.c","sha256":"a0407447270840acd8a9902c444693d97c765fd8e056dbadc66d36a3327fb0ef","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/executor/execMain.c#L68"},{"label":"Call sites","path":"src/backend/executor/execMain.c","sha256":"a0407447270840acd8a9902c444693d97c765fd8e056dbadc66d36a3327fb0ef","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/executor/execMain.c#L135"}],"translation_provenance":{"inputs":[{"label":"Interface declaration","path":"src/include/executor/executor.h","sha256":"65710b17bb91a8fe6367654bb27b67ef7a7c238f79ba46248f92a3b8302cd4bb","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/executor/executor.h#L75"},{"label":"Core definition","path":"src/backend/executor/execMain.c","sha256":"a0407447270840acd8a9902c444693d97c765fd8e056dbadc66d36a3327fb0ef","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/executor/execMain.c#L68"},{"label":"Call sites","path":"src/backend/executor/execMain.c","sha256":"a0407447270840acd8a9902c444693d97c765fd8e056dbadc66d36a3327fb0ef","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/executor/execMain.c#L135"}],"kind":"authored-source-translation","locale":"zh-Hans","source_revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","translated_source_sha256":"2e4a00af676e0a50df5823f773537e148900a9f6c4aa337c676b98c4f2fdecdf","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/executor/executor.h","sha256":"65710b17bb91a8fe6367654bb27b67ef7a7c238f79ba46248f92a3b8302cd4bb","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/executor/executor.h#L75"},{"label":"Core definition","path":"src/backend/executor/execMain.c","sha256":"a0407447270840acd8a9902c444693d97c765fd8e056dbadc66d36a3327fb0ef","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/executor/execMain.c#L68"},{"label":"Call sites","path":"src/backend/executor/execMain.c","sha256":"a0407447270840acd8a9902c444693d97c765fd8e056dbadc66d36a3327fb0ef","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/executor/execMain.c#L135"}]},"MeasuredEvidence":{}},"Text":{"Collection":"hook","Key":"executorstart_hook","SourceDatabase":"center","Version":"18","Locale":"en","Title":"ExecutorStart_hook","Summary":"Hook for plugins to get control in ExecutorStart()","BodyHTML":"\u003cp\u003eHook for plugins to get control in ExecutorStart()\u003c/p\u003e","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","ContentHash":"2c08d2e2091d337b650cafee4929ac4dd24baeb3b94a878bc94989e0da43a473","Payload":{"description":["Hook for plugins to get control in ExecutorStart()"],"related":[{"label":"The Executor","url":"/docs/18/executor.html"}],"sections":[{"paragraphs":["Hooks for plugins to get control in ExecutorStart/Run/Finish/End"],"title":"Core source comments"},{"paragraphs":["src/backend/executor/execMain.c:135"],"title":"Call sites"},{"code":"\t * call will be ignored if the top level query_id has already been\n\t * reported.\n\t */\n\tpgstat_report_query_id(queryDesc-\u003eplannedstmt-\u003equeryId, false);\n\n\tif (ExecutorStart_hook)\n\t\t(*ExecutorStart_hook) (queryDesc, eflags);\n\telse\n\t\tstandard_ExecutorStart(queryDesc, eflags);\n}\n\nvoid\nstandard_ExecutorStart(QueryDesc *queryDesc, int eflags)\n{\n\tEState\t   *estate;","paragraphs":[],"title":"Core call context: src/backend/executor/execMain.c:129–143"}]}},"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}
