1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +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

@ -169,6 +169,9 @@ static ProcSignalReason RecoveryConflictReason;
static MemoryContext row_description_context = NULL;
static StringInfoData row_description_buf;
/* Hook for plugins to get control at start of session */
session_start_hook_type session_start_hook = NULL;
/* ----------------------------------------------------------------
* decls for routines only used in this file
* ----------------------------------------------------------------
@ -3857,6 +3860,9 @@ PostgresMain(int argc, char *argv[],
if (!IsUnderPostmaster)
PgStartTime = GetCurrentTimestamp();
if (session_start_hook)
(*session_start_hook) ();
/*
* POSTGRES main processing loop begins here
*