diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2017-11-15 10:16:34 -0500 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2017-11-15 10:16:34 -0500 |
commit | cd8ce3a22c0b48d32ffe6543837ba3bb647ac2b2 (patch) | |
tree | a6f39aee1d21d35a7f1902c7714777311687344b /src/backend/tcop/postgres.c | |
parent | ebc189e12259cc28b9a09db000626fea1e2a3ffa (diff) | |
download | postgresql-cd8ce3a22c0b48d32ffe6543837ba3bb647ac2b2.tar.gz postgresql-cd8ce3a22c0b48d32ffe6543837ba3bb647ac2b2.zip |
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
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 05c5c194ec6..d3156ad49ef 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -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 * |