1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Add hooks for session start and session end

These hooks can be used in loadable modules. A simple test module is
included.

Discussion:  https://postgr.es/m/20170720204733.40f2b7eb.nagata@sraoss.co.jp

Fabrízio de Royes Mello  and Yugo Nagata
Reviewed by Michael Paquier and Aleksandr Parfenov
This commit is contained in:
Andrew Dunstan
2017-11-15 10:16:34 -05:00
parent ebc189e122
commit cd8ce3a22c
13 changed files with 233 additions and 0 deletions

View File

@ -76,6 +76,8 @@ static bool ThereIsAtLeastOneRole(void);
static void process_startup_options(Port *port, bool am_superuser);
static void process_settings(Oid databaseid, Oid roleid);
/* Hook for plugins to get control at end of session */
session_end_hook_type session_end_hook = NULL;
/*** InitPostgres support ***/
@ -1154,6 +1156,10 @@ ShutdownPostgres(int code, Datum arg)
* them explicitly.
*/
LockReleaseAll(USER_LOCKMETHOD, true);
/* Hook at session end */
if (session_end_hook)
(*session_end_hook) ();
}