An extension enabling execution of a function on login

login_hook is an extension enabling execution of a custom function following a user login.


login_hook relies on the extension being included in the session_preload_libraries configuration parameter, so that its _PG_init() function is executed on login. This calls a user-defined function, which must be named login_hook.login(). If the extension (more specifically its schema) is not present, no action will be taken.

Careful consideration is needed before deploying this solution in a production environment.

Release history

  • 1.4 (2022-08-24)
  • 1.3 (2021-07-10)
  • 1.2 (2021-06-16)
  • 1.1 (2021-02-09)

login_hook was created in January 2018 (commit 91c6ae10). No 1.0 release tag exists.


Authentication, Database connections, Extension, Users and roles