{"id":13468860,"url":"https://github.com/taminomara/psql-hooks","last_synced_at":"2026-01-16T11:28:26.415Z","repository":{"id":40994294,"uuid":"125717618","full_name":"taminomara/psql-hooks","owner":"taminomara","description":"Unofficial documentation for PostgreSQL hooks","archived":false,"fork":false,"pushed_at":"2023-04-07T10:50:35.000Z","size":129,"stargazers_count":192,"open_issues_count":1,"forks_count":35,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-29T17:02:27.603Z","etag":null,"topics":["postgresql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taminomara.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-03-18T11:24:25.000Z","updated_at":"2025-04-28T12:47:49.000Z","dependencies_parsed_at":"2024-01-17T03:15:36.853Z","dependency_job_id":"2c7db7d2-3634-412c-8918-d1610e00b374","html_url":"https://github.com/taminomara/psql-hooks","commit_stats":null,"previous_names":["amatanhead/psql-hooks"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/taminomara/psql-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taminomara%2Fpsql-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taminomara%2Fpsql-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taminomara%2Fpsql-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taminomara%2Fpsql-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taminomara","download_url":"https://codeload.github.com/taminomara/psql-hooks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taminomara%2Fpsql-hooks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postgresql"],"created_at":"2024-07-31T15:01:20.670Z","updated_at":"2026-01-16T11:28:21.407Z","avatar_url":"https://github.com/taminomara.png","language":"Python","funding_links":[],"categories":["Python","Core Hacking"],"sub_categories":["General"],"readme":"# Postgresql hooks documentation\n\nUnofficial documentation for PostgreSQL hooks.\n\n\u003e *Denial of responsibility:*\n\u003e \n\u003e This work is not a part of the official PostgreSQL documentation.\n\u003e \n\u003e Contents of this repository were compiled by Begishev Nikita and\n\u003e Goncharov Vladimir, neither of whom appear to be a developer or a maintainer\n\u003e of the PostgreSQL Database Management System.\n\u003e\n\u003e Use this documentation at your own risk.\n\u003e\n\u003e \n\u003e *Copyright notice:*\n\u003e \n\u003e This work combines some research made by contributors with\n\u003e information acquired from the postgres source code, comments and\n\u003e documentation. Some contents of this work were copied from source code\n\u003e comments as is, others were written from scratch.\n\u003e \n\u003e In no way we (Begishev Nikita and Goncharov Vladimir) claim copyright on texts\n\u003e that were copied or adapted from the sources described above.\n\u003e\n\u003e This work is distributed under the terms of the PostgreSQL License, a copy of\n\u003e which may be found in the file called 'License.md'.\n\nPostgreSQL hooks are a simple way to extend functionality of the database.\nThey allow extensions to introspect database state, react to events and\ninterfere with database operations.\n\nIn terms of the programming language, each hook is a pointer to a function\nof a specific type, initially set to be `NULL`.\n\nUpon init, database extensions are free to overwrite those function pointers\nwith their own values. A previous value of the overwritten pointer is usually\nstored withing the extension local memory.\n\nDuring its work, postgres checks whether certain function pointers are not null\nand if that's the case, calls them.\n\nSee the [detailed description](Detailed.md) for an explanation on\nhow to implement a hook and an example.\n\n* [General Hooks](#general-hooks)\n* [Security Hooks](#security-hooks)\n* [Function Manager Hooks](#function-manager-hooks)\n* [Planner Hooks](#planner-hooks)\n* [Executor Hooks](#executor-hooks)\n* [PL/pgsql Hooks](#plpgsql-hooks)\n\n\n## [General Hooks](Detailed.md#general-hooks)\n\n\n\n* [emit_log_hook](Detailed.md#emit_log_hook) — hook for intercepting messages before they are sent to the server log.\n* [shmem_startup_hook](Detailed.md#shmem_startup_hook) — hook for extensions to initialize their shared memory.\n\n## [Security Hooks](Detailed.md#security-hooks)\n\n\n\n* [check_password_hook](Detailed.md#check_password_hook) — hook for enforcing password constraints and performing action on password change.\n* [ClientAuthentication_hook](Detailed.md#ClientAuthentication_hook) — hook for controlling the authentication process.\n* [ExecutorCheckPerms_hook](Detailed.md#ExecutorCheckPerms_hook) — hook for adding additional security checks on the per-relation level.\n* [object_access_hook](Detailed.md#object_access_hook) — hook to monitor accesses to objects.\n* [row_security_policy_hook_permissive](Detailed.md#row_security_policy_hook_permissive) — hook to add policies which are combined with the other permissive policies.\n* [row_security_policy_hook_restrictive](Detailed.md#row_security_policy_hook_restrictive) — hook to add policies which are enforced, regardless of other policies.\n\n## [Function Manager Hooks](Detailed.md#function-manager-hooks)\n\n\n\n* [needs_fmgr_hook](Detailed.md#needs_fmgr_hook) — auxiliary hook which decides whether `fmgr_hook` should be applied to a function.\n* [fmgr_hook](Detailed.md#fmgr_hook) — hook for controlling function execution process.\n\n## [Planner Hooks](Detailed.md#planner-hooks)\n\n\n\n* [explain_get_index_name_hook](Detailed.md#explain_get_index_name_hook) — hook for altering index names in explain statements.\n* [ExplainOneQuery_hook](Detailed.md#ExplainOneQuery_hook) — hook for overriding explain procedure for a single query.\n* [get_attavgwidth_hook](Detailed.md#get_attavgwidth_hook) — hook for controlling an algorithm for predicting the average width of entries in the column.\n* [get_index_stats_hook](Detailed.md#get_index_stats_hook) — hook for overriding index stats lookup.\n* [get_relation_info_hook](Detailed.md#get_relation_info_hook) — hook for altering results of the relation info lookup.\n* [get_relation_stats_hook](Detailed.md#get_relation_stats_hook) — hook for overriding relation stats lookup.\n* [planner_hook](Detailed.md#planner_hook) — called in query optimizer entry point.\n* [join_search_hook](Detailed.md#join_search_hook) — called when optimiser chooses order for join relations.\n* [set_rel_pathlist_hook](Detailed.md#set_rel_pathlist_hook) — called at the end of building access paths for a base relation.\n* [set_join_pathlist_hook](Detailed.md#set_join_pathlist_hook) — called at the end of the process of joinrel modification to contain the best paths.\n* [create_upper_paths_hook](Detailed.md#create_upper_paths_hook) — called when postprocess of the path of set operations occurs.\n* [post_parse_analyze_hook](Detailed.md#post_parse_analyze_hook) — called when parse analyze goes, right after performing transformTopLevelStmt().\n\n## [Executor Hooks](Detailed.md#executor-hooks)\n\n\n\n* [ExecutorStart_hook](Detailed.md#ExecutorStart_hook) — called at the beginning of any execution of any query plan.\n* [ExecutorRun_hook](Detailed.md#ExecutorRun_hook) — called at any plan execution, after ExecutorStart.\n* [ExecutorFinish_hook](Detailed.md#ExecutorFinish_hook) — called after the last ExecutorRun call\n* [ExecutorEnd_hook](Detailed.md#ExecutorEnd_hook) — called at the end of execution of any query plan.\n* [ProcessUtility_hook](Detailed.md#ProcessUtility_hook) — hook for the ProcessUtility.\n\n## [PL/pgsql Hooks](Detailed.md#plpgsql-hooks)\n\n\n\n* [func_setup](Detailed.md#func_setup) — hook for intercepting PLpgSQL function pre-init phase.\n* [func_beg](Detailed.md#func_beg) — hook for intercepting post-init phase.\n* [func_end](Detailed.md#func_end) — hook for intercepting end of a function.\n* [stmt_beg](Detailed.md#stmt_beg) — called before each statement of a function.\n* [stmt_end](Detailed.md#stmt_end) — called after each statement of a function.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaminomara%2Fpsql-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaminomara%2Fpsql-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaminomara%2Fpsql-hooks/lists"}