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

login_hook was created in January 2018 (commit 91c6ae10). The repository does not contain any tags, but a 1.1 release was created in August 2020 (commit acef944b).


Authentication, Database connections, Extension, Users and roles