Git Product home page Git Product logo

psql-hooks-for-postgres-extensions's Introduction

Postgresql hooks documentation

Unofficial documentation for PostgreSQL hooks.

Denial of responsibility:

This work is not a part of the official PostgreSQL documentation.

Contents of this repository were compiled by Begishev Nikita and Goncharov Vladimir, neither of whom appear to be a developer or a maintainer of the PostgreSQL Database Management System.

Use this documentation at your own risk.

Copyright notice:

This work combines some research made by contributors with information acquired from the postgres source code, comments and documentation. Some contents of this work were copied from source code comments as is, others were written from scratch.

In no way we (Begishev Nikita and Goncharov Vladimir) claim copyright on texts that were copied or adapted from the sources described above.

This work is distributed under the terms of the PostgreSQL License, a copy of which may be found in the file called 'License.md'.

PostgreSQL hooks are a simple way to extend functionality of the database. They allow extensions to introspect database state, react to events and interfere with database operations.

In terms of the programming language, each hook is a pointer to a function of a specific type, initially set to be NULL.

Upon init, database extensions are free to overwrite those function pointers with their own values. A previous value of the overwritten pointer is usually stored withing the extension local memory.

During its work, postgres checks whether certain function pointers are not null and if that's the case, calls them.

See the detailed description for an explanation on how to implement a hook and an example.

  • emit_log_hook — hook for intercepting messages before they are sent to the server log.
  • shmem_startup_hook — hook for extensions to initialize their shared memory.
  • needs_fmgr_hook — auxiliary hook which decides whether fmgr_hook should be applied to a function.
  • fmgr_hook — hook for controlling function execution process.
  • func_setup — hook for intercepting PLpgSQL function pre-init phase.
  • func_beg — hook for intercepting post-init phase.
  • func_end — hook for intercepting end of a function.
  • stmt_beg — called before each statement of a function.
  • stmt_end — called after each statement of a function.

psql-hooks-for-postgres-extensions's People

Contributors

notwhaleb avatar amatanhead avatar taminomara avatar xzyaoi avatar tsinghualucky912 avatar

Stargazers

Yannam C Chiranjeevi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.