{"Entry":{"collection":"hook","key":"object_access_hook","name":"object_access_hook","aliases":[],"metadata":{"aliases":[],"category":"Permissions and object access","content_hash":"8b52090e31aef806ad8077906062e2ae1a510df069fb79b3653067bb3acc7c62","derived_content_hash":"fb27970a9c40032fb3e2a0de148b1c0147f0d78266c409fc299934eeac78ad61","imported_at":"2026-09-27T17:57:58.853424+08:00","name":"object_access_hook","name_zh":"object_access_hook","repair_provenance":{"original_source_revision":"","receipt_sha256":"97e2671477d0ef266cea8eb06066449fcb333bdfe8f916c1632cdb1e2687734a","repair":"wiki-repair-20261023"},"slug":"object_access_hook","source_rev":"wiki-repair-20261023:048cd0352273818578acc608c9a7ecfeaef742c4406a2e778001354a00763c2b","summary":"Plugin provides a hook function matching one or both of these signatures."}},"Definition":{"Collection":"hook","Key":"object_access_hook","SourceDatabase":"center","Version":"18","SourceTable":"hook","SourceKey":"object_access_hook","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","Facts":{"description":["Plugin provides a hook function matching one or both of these signatures."],"description_zh":"插件提供与这些签名之一或两者匹配的钩子函数。","description_zh_html":"\u003cp\u003e插件提供与这些签名之一或两者匹配的钩子函数。\u003c/p\u003e\u003cp\u003e以下中文为本站依据所列 PostgreSQL 源码注释编译的说明。\u003c/p\u003e\u003ch3\u003e接口声明\u003c/h3\u003e\u003cpre\u003etypedef void (*object_access_hook_type) (ObjectAccessType access, Oid classId, Oid objectId, int subId, void *arg);\nextern PGDLLIMPORT object_access_hook_type object_access_hook;\u003c/pre\u003e\u003ch3\u003e源码说明\u003c/h3\u003e\u003cp\u003e对象访问钩子，为安全和日志插件提供基础设施。\u003c/p\u003e\u003ch3\u003e调用位置\u003c/h3\u003e\u003cul\u003e\u003cli\u003e\u003ccode\u003esrc/backend/catalog/objectaccess.c:43\u003c/code\u003e\u003c/li\u003e\u003cli\u003e\u003ccode\u003esrc/backend/catalog/objectaccess.c:65\u003c/code\u003e\u003c/li\u003e\u003cli\u003e\u003ccode\u003esrc/backend/catalog/objectaccess.c:81\u003c/code\u003e\u003c/li\u003e\u003cli\u003e\u003ccode\u003esrc/backend/catalog/objectaccess.c:104\u003c/code\u003e\u003c/li\u003e\u003cli\u003e\u003ccode\u003esrc/backend/catalog/objectaccess.c:126\u003c/code\u003e\u003c/li\u003e\u003cli\u003e\u003ccode\u003esrc/backend/catalog/objectaccess.c:144\u003c/code\u003e\u003c/li\u003e\u003c/ul\u003e\u003ch3\u003e核心调用上下文：src/backend/catalog/objectaccess.c:37–51\u003c/h3\u003e\u003cpre\u003e\t/* caller should check, but just in case... */\n\tAssert(object_access_hook != NULL);\n\n\tmemset(\u0026amp;pc_arg, 0, sizeof(ObjectAccessPostCreate));\n\tpc_arg.is_internal = is_internal;\n\n\t(*object_access_hook) (OAT_POST_CREATE,\n\t\t\t\t\t\t   classId, objectId, subId,\n\t\t\t\t\t\t   \u0026amp;pc_arg);\n}\n\n/*\n * RunObjectDropHook\n *\n * OAT_DROP object ID based event hook entrypoint\u003c/pre\u003e\u003ch3\u003e核心调用上下文：src/backend/catalog/objectaccess.c:59–73\u003c/h3\u003e\u003cpre\u003e\t/* caller should check, but just in case... */\n\tAssert(object_access_hook != NULL);\n\n\tmemset(\u0026amp;drop_arg, 0, sizeof(ObjectAccessDrop));\n\tdrop_arg.dropflags = dropflags;\n\n\t(*object_access_hook) (OAT_DROP,\n\t\t\t\t\t\t   classId, objectId, subId,\n\t\t\t\t\t\t   \u0026amp;drop_arg);\n}\n\n/*\n * RunObjectTruncateHook\n *\n * OAT_TRUNCATE object ID based event hook entrypoint\u003c/pre\u003e\u003ch3\u003e核心调用上下文：src/backend/catalog/objectaccess.c:75–89\u003c/h3\u003e\u003cpre\u003evoid\nRunObjectTruncateHook(Oid objectId)\n{\n\t/* caller should check, but just in case... */\n\tAssert(object_access_hook != NULL);\n\n\t(*object_access_hook) (OAT_TRUNCATE,\n\t\t\t\t\t\t   RelationRelationId, objectId, 0,\n\t\t\t\t\t\t   NULL);\n}\n\n/*\n * RunObjectPostAlterHook\n *\n * OAT_POST_ALTER object ID based event hook entrypoint\u003c/pre\u003e","facts":[{"label":"Interface type","value":"object_access_hook_type"},{"label":"Header","value":"src/include/catalog/objectaccess.h"},{"label":"Subsystem","value":"Permissions and object access"},{"label":"Initial value","value":"NULL (no hook installed)"}],"related":[],"release":{"channel":"stable","label":"18","major":"18","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd"},"sections":[{"paragraphs":["Hook on object accesses. This is intended as infrastructure for security and logging plugins."],"title":"Core source comments"},{"paragraphs":["src/backend/catalog/objectaccess.c:43","src/backend/catalog/objectaccess.c:65","src/backend/catalog/objectaccess.c:81","src/backend/catalog/objectaccess.c:104","src/backend/catalog/objectaccess.c:126","src/backend/catalog/objectaccess.c:144"],"title":"Call sites"},{"code":"\t/* caller should check, but just in case... */\n\tAssert(object_access_hook != NULL);\n\n\tmemset(\u0026pc_arg, 0, sizeof(ObjectAccessPostCreate));\n\tpc_arg.is_internal = is_internal;\n\n\t(*object_access_hook) (OAT_POST_CREATE,\n\t\t\t\t\t\t   classId, objectId, subId,\n\t\t\t\t\t\t   \u0026pc_arg);\n}\n\n/*\n * RunObjectDropHook\n *\n * OAT_DROP object ID based event hook entrypoint","paragraphs":[],"title":"Core call context: src/backend/catalog/objectaccess.c:37–51"},{"code":"\t/* caller should check, but just in case... */\n\tAssert(object_access_hook != NULL);\n\n\tmemset(\u0026drop_arg, 0, sizeof(ObjectAccessDrop));\n\tdrop_arg.dropflags = dropflags;\n\n\t(*object_access_hook) (OAT_DROP,\n\t\t\t\t\t\t   classId, objectId, subId,\n\t\t\t\t\t\t   \u0026drop_arg);\n}\n\n/*\n * RunObjectTruncateHook\n *\n * OAT_TRUNCATE object ID based event hook entrypoint","paragraphs":[],"title":"Core call context: src/backend/catalog/objectaccess.c:59–73"},{"code":"void\nRunObjectTruncateHook(Oid objectId)\n{\n\t/* caller should check, but just in case... */\n\tAssert(object_access_hook != NULL);\n\n\t(*object_access_hook) (OAT_TRUNCATE,\n\t\t\t\t\t\t   RelationRelationId, objectId, 0,\n\t\t\t\t\t\t   NULL);\n}\n\n/*\n * RunObjectPostAlterHook\n *\n * OAT_POST_ALTER object ID based event hook entrypoint","paragraphs":[],"title":"Core call context: src/backend/catalog/objectaccess.c:75–89"}],"signature":"typedef void (*object_access_hook_type) (ObjectAccessType access, Oid classId, Oid objectId, int subId, void *arg);\nextern PGDLLIMPORT object_access_hook_type object_access_hook;","sources":[{"label":"Interface declaration","path":"src/include/catalog/objectaccess.h","sha256":"600e3cf42fb4c9bd8cdfa7f048dd1b7677bad5c558c9b65ecb976145d14c7781","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/catalog/objectaccess.h#L127"},{"label":"Core definition","path":"src/backend/catalog/objectaccess.c","sha256":"37c09c923b0b0f07bcff22462814d4282fae75355b2e9058d63c68de2be76c91","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/catalog/objectaccess.c#L22"},{"label":"Call sites","path":"src/backend/catalog/objectaccess.c","sha256":"37c09c923b0b0f07bcff22462814d4282fae75355b2e9058d63c68de2be76c91","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/catalog/objectaccess.c#L43"}],"translation_provenance":{"inputs":[{"label":"Interface declaration","path":"src/include/catalog/objectaccess.h","sha256":"600e3cf42fb4c9bd8cdfa7f048dd1b7677bad5c558c9b65ecb976145d14c7781","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/catalog/objectaccess.h#L127"},{"label":"Core definition","path":"src/backend/catalog/objectaccess.c","sha256":"37c09c923b0b0f07bcff22462814d4282fae75355b2e9058d63c68de2be76c91","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/catalog/objectaccess.c#L22"},{"label":"Call sites","path":"src/backend/catalog/objectaccess.c","sha256":"37c09c923b0b0f07bcff22462814d4282fae75355b2e9058d63c68de2be76c91","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/catalog/objectaccess.c#L43"}],"kind":"authored-source-translation","locale":"zh-Hans","source_revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","translated_source_sha256":"b721101be04f7b1d71e40033dc67f8776a2afb097d5d83f00251d47e63b8e180","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/catalog/objectaccess.h","sha256":"600e3cf42fb4c9bd8cdfa7f048dd1b7677bad5c558c9b65ecb976145d14c7781","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/catalog/objectaccess.h#L127"},{"label":"Core definition","path":"src/backend/catalog/objectaccess.c","sha256":"37c09c923b0b0f07bcff22462814d4282fae75355b2e9058d63c68de2be76c91","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/catalog/objectaccess.c#L22"},{"label":"Call sites","path":"src/backend/catalog/objectaccess.c","sha256":"37c09c923b0b0f07bcff22462814d4282fae75355b2e9058d63c68de2be76c91","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/catalog/objectaccess.c#L43"}]},"MeasuredEvidence":{}},"Text":{"Collection":"hook","Key":"object_access_hook","SourceDatabase":"center","Version":"18","Locale":"en","Title":"object_access_hook","Summary":"Plugin provides a hook function matching one or both of these signatures.","BodyHTML":"\u003cp\u003ePlugin provides a hook function matching one or both of these signatures.\u003c/p\u003e","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","ContentHash":"33c0e6f1fa688e93d589d123fc65557cd161586b3d88835519026d873dbe0e77","Payload":{"description":["Plugin provides a hook function matching one or both of these signatures."],"related":[],"sections":[{"paragraphs":["Hook on object accesses. This is intended as infrastructure for security and logging plugins."],"title":"Core source comments"},{"paragraphs":["src/backend/catalog/objectaccess.c:43","src/backend/catalog/objectaccess.c:65","src/backend/catalog/objectaccess.c:81","src/backend/catalog/objectaccess.c:104","src/backend/catalog/objectaccess.c:126","src/backend/catalog/objectaccess.c:144"],"title":"Call sites"},{"code":"\t/* caller should check, but just in case... */\n\tAssert(object_access_hook != NULL);\n\n\tmemset(\u0026pc_arg, 0, sizeof(ObjectAccessPostCreate));\n\tpc_arg.is_internal = is_internal;\n\n\t(*object_access_hook) (OAT_POST_CREATE,\n\t\t\t\t\t\t   classId, objectId, subId,\n\t\t\t\t\t\t   \u0026pc_arg);\n}\n\n/*\n * RunObjectDropHook\n *\n * OAT_DROP object ID based event hook entrypoint","paragraphs":[],"title":"Core call context: src/backend/catalog/objectaccess.c:37–51"},{"code":"\t/* caller should check, but just in case... */\n\tAssert(object_access_hook != NULL);\n\n\tmemset(\u0026drop_arg, 0, sizeof(ObjectAccessDrop));\n\tdrop_arg.dropflags = dropflags;\n\n\t(*object_access_hook) (OAT_DROP,\n\t\t\t\t\t\t   classId, objectId, subId,\n\t\t\t\t\t\t   \u0026drop_arg);\n}\n\n/*\n * RunObjectTruncateHook\n *\n * OAT_TRUNCATE object ID based event hook entrypoint","paragraphs":[],"title":"Core call context: src/backend/catalog/objectaccess.c:59–73"},{"code":"void\nRunObjectTruncateHook(Oid objectId)\n{\n\t/* caller should check, but just in case... */\n\tAssert(object_access_hook != NULL);\n\n\t(*object_access_hook) (OAT_TRUNCATE,\n\t\t\t\t\t\t   RelationRelationId, objectId, 0,\n\t\t\t\t\t\t   NULL);\n}\n\n/*\n * RunObjectPostAlterHook\n *\n * OAT_POST_ALTER object ID based event hook entrypoint","paragraphs":[],"title":"Core call context: src/backend/catalog/objectaccess.c:75–89"}]}},"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}
