From 4800a5dfb4c46d22b5d05f16c615bea6ff24a2bb Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Wed, 11 Oct 2023 12:31:49 +0900 Subject: Refactor InitPostgres() to use bitwise option flags InitPostgres() has been using a set of boolean arguments to control its behavior, and a patch under discussion was aiming at expanding it with a third one. In preparation for expanding this area, this commit switches all the current boolean arguments of this routine to a single bits32 argument instead. Two values are currently supported for the flags: - INIT_PG_LOAD_SESSION_LIBS to load [session|local]_preload_libraries at startup. - INIT_PG_OVERRIDE_ALLOW_CONNS to allow connection to a database even if it has !datallowconn. This is used by bgworkers. Reviewed-by: Bertrand Drouvot Discussion: https://postgr.es/m/ZSTn66_BXRZCeaqS@paquier.xyz --- src/include/miscadmin.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/include/miscadmin.h') diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 14bd574fc24..1cc3712c0ff 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -463,12 +463,14 @@ extern PGDLLIMPORT AuxProcType MyAuxProcType; *****************************************************************************/ /* in utils/init/postinit.c */ +/* flags for InitPostgres() */ +#define INIT_PG_LOAD_SESSION_LIBS 0x0001 +#define INIT_PG_OVERRIDE_ALLOW_CONNS 0x0002 extern void pg_split_opts(char **argv, int *argcp, const char *optstr); extern void InitializeMaxBackends(void); extern void InitPostgres(const char *in_dbname, Oid dboid, const char *username, Oid useroid, - bool load_session_libraries, - bool override_allow_connections, + bits32 flags, char *out_dbname); extern void BaseInit(void); -- cgit v1.2.3