1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-21 02:52:47 +03:00

Add hooks for session start and session end, take two

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

The first attempt was done with cd8ce3a but we lacked handling for
NO_INSTALLCHECK in the MSVC scripts (problem solved afterwards by
431f1599) so the buildfarm got angry.  This also fixes a couple of
issues noticed upon review compared to the first attempt, so the code
has slightly changed, resulting in a more simple test module.

Author: Fabrízio de Royes Mello, Yugo Nagata
Reviewed-by: Andrew Dunstan, Michael Paquier, Aleksandr Parfenov
Discussion: https://postgr.es/m/20170720204733.40f2b7eb.nagata@sraoss.co.jp
Discussion: https://postgr.es/m/20190823042602.GB5275@paquier.xyz
This commit is contained in:
Michael Paquier
2019-10-01 12:15:25 +09:00
parent 41a6de41ed
commit e788bd924c
11 changed files with 262 additions and 0 deletions

View File

@@ -30,6 +30,13 @@ extern PGDLLIMPORT const char *debug_query_string;
extern int max_stack_depth;
extern int PostAuthDelay;
/* Hook for plugins to get control at start and end of session */
typedef void (*session_start_hook_type) (void);
typedef void (*session_end_hook_type) (void);
extern PGDLLIMPORT session_start_hook_type session_start_hook;
extern PGDLLIMPORT session_end_hook_type session_end_hook;
/* GUC-configurable parameters */
typedef enum