{"Entry":{"collection":"hook","key":"fmgr_hook","name":"fmgr_hook","aliases":[],"metadata":{"aliases":[],"category":"Logging and function calls","content_hash":"4a575546e6f51fba9d5c8867a180462172240e1ba692cebdba7656cd970a59bb","imported_at":"2026-09-27T17:57:58.842876+08:00","name":"fmgr_hook","name_zh":"fmgr_hook","slug":"fmgr_hook","summary":"function manager hook"}},"Definition":{"Collection":"hook","Key":"fmgr_hook","SourceDatabase":"center","Version":"18","SourceTable":"hook","SourceKey":"fmgr_hook","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","Facts":{"description":["function manager hook"],"facts":[{"label":"Interface type","value":"fmgr_hook_type"},{"label":"Header","value":"src/include/fmgr.h"},{"label":"Subsystem","value":"Logging and function calls"},{"label":"Initial value","value":"NULL (no hook installed)"}],"related":[],"release":{"channel":"stable","label":"18","major":"18","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd"},"sections":[{"paragraphs":["src/backend/utils/fmgr/fmgr.c:731","src/backend/utils/fmgr/fmgr.c:762","src/backend/utils/fmgr/fmgr.c:774"],"title":"Call sites"},{"code":"\t\t\t\t\t\t\t\t\t  context, source, GetUserId(),\n\t\t\t\t\t\t\t\t\t  action, true, 0, false);\n\t}\n\n\t/* function manager hook */\n\tif (fmgr_hook)\n\t\t(*fmgr_hook) (FHET_START, \u0026fcache-\u003eflinfo, \u0026fcache-\u003earg);\n\n\t/*\n\t * We don't need to restore GUC or userid settings on error, because the\n\t * ensuing xact or subxact abort will do that.  The PG_TRY block is only\n\t * needed to clean up the flinfo link.\n\t */\n\tsave_flinfo = fcinfo-\u003eflinfo;\n","paragraphs":[],"title":"Core call context: src/backend/utils/fmgr/fmgr.c:725–739"},{"code":"\t\t\t\t\t\t\t\t   ((ReturnSetInfo *) fcinfo-\u003eresultinfo)-\u003eisDone != ExprMultipleResult));\n\t}\n\tPG_CATCH();\n\t{\n\t\tfcinfo-\u003eflinfo = save_flinfo;\n\t\tif (fmgr_hook)\n\t\t\t(*fmgr_hook) (FHET_ABORT, \u0026fcache-\u003eflinfo, \u0026fcache-\u003earg);\n\t\tPG_RE_THROW();\n\t}\n\tPG_END_TRY();\n\n\tfcinfo-\u003eflinfo = save_flinfo;\n\n\tif (fcache-\u003econfigNames != NIL)\n\t\tAtEOXact_GUC(true, save_nestlevel);","paragraphs":[],"title":"Core call context: src/backend/utils/fmgr/fmgr.c:756–770"},{"code":"\n\tif (fcache-\u003econfigNames != NIL)\n\t\tAtEOXact_GUC(true, save_nestlevel);\n\tif (OidIsValid(fcache-\u003euserid))\n\t\tSetUserIdAndSecContext(save_userid, save_sec_context);\n\tif (fmgr_hook)\n\t\t(*fmgr_hook) (FHET_END, \u0026fcache-\u003eflinfo, \u0026fcache-\u003earg);\n\n\treturn result;\n}\n\n\n/*-------------------------------------------------------------------------\n *\t\tSupport routines for callers of fmgr-compatible functions\n *-------------------------------------------------------------------------","paragraphs":[],"title":"Core call context: src/backend/utils/fmgr/fmgr.c:768–782"}],"signature":"typedef void (*fmgr_hook_type) (FmgrHookEventType event, FmgrInfo *flinfo, Datum *arg);\nextern PGDLLIMPORT fmgr_hook_type fmgr_hook;","sources":[{"label":"Interface declaration","path":"src/include/fmgr.h","sha256":"9ae7c92915f702ee93be2b6aed3574edfeb7fb2effae8beb256665f307db961b","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/fmgr.h#L842"},{"label":"Core definition","path":"src/backend/utils/fmgr/fmgr.c","sha256":"6cec6e3c08f69e71bfaa67294ac6889c9278a7963e2c676de709782c0c594e75","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/fmgr/fmgr.c#L40"},{"label":"Call sites","path":"src/backend/utils/fmgr/fmgr.c","sha256":"6cec6e3c08f69e71bfaa67294ac6889c9278a7963e2c676de709782c0c594e75","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/fmgr/fmgr.c#L731"}]},"ManualEvidence":{"release":{"channel":"stable","label":"18","major":"18","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd"},"sources":[{"label":"Interface declaration","path":"src/include/fmgr.h","sha256":"9ae7c92915f702ee93be2b6aed3574edfeb7fb2effae8beb256665f307db961b","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/fmgr.h#L842"},{"label":"Core definition","path":"src/backend/utils/fmgr/fmgr.c","sha256":"6cec6e3c08f69e71bfaa67294ac6889c9278a7963e2c676de709782c0c594e75","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/fmgr/fmgr.c#L40"},{"label":"Call sites","path":"src/backend/utils/fmgr/fmgr.c","sha256":"6cec6e3c08f69e71bfaa67294ac6889c9278a7963e2c676de709782c0c594e75","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/fmgr/fmgr.c#L731"}]},"MeasuredEvidence":{}},"Text":{"Collection":"hook","Key":"fmgr_hook","SourceDatabase":"center","Version":"18","Locale":"en","Title":"fmgr_hook","Summary":"function manager hook","BodyHTML":"\u003cp\u003efunction manager hook\u003c/p\u003e","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","ContentHash":"af543dbd6960b9ec9e72ff8a9b50f849c801af9b94d951e439587a850e2ec16d","Payload":{"description":["function manager hook"],"related":[],"sections":[{"paragraphs":["src/backend/utils/fmgr/fmgr.c:731","src/backend/utils/fmgr/fmgr.c:762","src/backend/utils/fmgr/fmgr.c:774"],"title":"Call sites"},{"code":"\t\t\t\t\t\t\t\t\t  context, source, GetUserId(),\n\t\t\t\t\t\t\t\t\t  action, true, 0, false);\n\t}\n\n\t/* function manager hook */\n\tif (fmgr_hook)\n\t\t(*fmgr_hook) (FHET_START, \u0026fcache-\u003eflinfo, \u0026fcache-\u003earg);\n\n\t/*\n\t * We don't need to restore GUC or userid settings on error, because the\n\t * ensuing xact or subxact abort will do that.  The PG_TRY block is only\n\t * needed to clean up the flinfo link.\n\t */\n\tsave_flinfo = fcinfo-\u003eflinfo;\n","paragraphs":[],"title":"Core call context: src/backend/utils/fmgr/fmgr.c:725–739"},{"code":"\t\t\t\t\t\t\t\t   ((ReturnSetInfo *) fcinfo-\u003eresultinfo)-\u003eisDone != ExprMultipleResult));\n\t}\n\tPG_CATCH();\n\t{\n\t\tfcinfo-\u003eflinfo = save_flinfo;\n\t\tif (fmgr_hook)\n\t\t\t(*fmgr_hook) (FHET_ABORT, \u0026fcache-\u003eflinfo, \u0026fcache-\u003earg);\n\t\tPG_RE_THROW();\n\t}\n\tPG_END_TRY();\n\n\tfcinfo-\u003eflinfo = save_flinfo;\n\n\tif (fcache-\u003econfigNames != NIL)\n\t\tAtEOXact_GUC(true, save_nestlevel);","paragraphs":[],"title":"Core call context: src/backend/utils/fmgr/fmgr.c:756–770"},{"code":"\n\tif (fcache-\u003econfigNames != NIL)\n\t\tAtEOXact_GUC(true, save_nestlevel);\n\tif (OidIsValid(fcache-\u003euserid))\n\t\tSetUserIdAndSecContext(save_userid, save_sec_context);\n\tif (fmgr_hook)\n\t\t(*fmgr_hook) (FHET_END, \u0026fcache-\u003eflinfo, \u0026fcache-\u003earg);\n\n\treturn result;\n}\n\n\n/*-------------------------------------------------------------------------\n *\t\tSupport routines for callers of fmgr-compatible functions\n *-------------------------------------------------------------------------","paragraphs":[],"title":"Core call context: src/backend/utils/fmgr/fmgr.c:768–782"}]}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
