@ -681,8 +681,9 @@ BaseInit(void)
* Parameters :
* Parameters :
* in_dbname , dboid : specify database to connect to , as described below
* in_dbname , dboid : specify database to connect to , as described below
* username , useroid : specify role to connect as , as described below
* username , useroid : specify role to connect as , as described below
* load_session_libraries : TRUE to honor [ session | local ] _preload_libraries
* flags :
* override_allow_connections : TRUE to connect despite ! datallowconn
* - INIT_PG_LOAD_SESSION_LIBS to honor [ session | local ] _preload_libraries .
* - INIT_PG_OVERRIDE_ALLOW_CONNS to connect despite ! datallowconn .
* out_dbname : optional output parameter , see below ; pass NULL if not used
* out_dbname : optional output parameter , see below ; pass NULL if not used
*
*
* The database can be specified by name , using the in_dbname parameter , or by
* The database can be specified by name , using the in_dbname parameter , or by
@ -701,8 +702,8 @@ BaseInit(void)
* database but not a username ; conversely , a physical walsender specifies
* database but not a username ; conversely , a physical walsender specifies
* username but not database .
* username but not database .
*
*
* By convention , load_session_libraries should be passed as true in
* By convention , INIT_PG_LOAD_SESSION_LIBS should be passed in " flags " in
* " interactive " sessions ( including standalone backends ) , but false in
* " interactive " sessions ( including standalone backends ) , but not in
* background processes such as autovacuum . Note in particular that it
* background processes such as autovacuum . Note in particular that it
* shouldn ' t be true in parallel worker processes ; those have another
* shouldn ' t be true in parallel worker processes ; those have another
* mechanism for replicating their leader ' s set of loaded libraries .
* mechanism for replicating their leader ' s set of loaded libraries .
@ -717,8 +718,7 @@ BaseInit(void)
void
void
InitPostgres ( const char * in_dbname , Oid dboid ,
InitPostgres ( const char * in_dbname , Oid dboid ,
const char * username , Oid useroid ,
const char * username , Oid useroid ,
bool load_session_libraries ,
bits32 flags ,
bool override_allow_connections ,
char * out_dbname )
char * out_dbname )
{
{
bool bootstrap = IsBootstrapProcessingMode ( ) ;
bool bootstrap = IsBootstrapProcessingMode ( ) ;
@ -1189,7 +1189,8 @@ InitPostgres(const char *in_dbname, Oid dboid,
* user is a superuser , so the above stuff has to happen first . )
* user is a superuser , so the above stuff has to happen first . )
*/
*/
if ( ! bootstrap )
if ( ! bootstrap )
CheckMyDatabase ( dbname , am_superuser , override_allow_connections ) ;
CheckMyDatabase ( dbname , am_superuser ,
( flags & INIT_PG_OVERRIDE_ALLOW_CONNS ) ! = 0 ) ;
/*
/*
* Now process any command - line switches and any additional GUC variable
* Now process any command - line switches and any additional GUC variable
@ -1227,7 +1228,7 @@ InitPostgres(const char *in_dbname, Oid dboid,
* during the initial transaction in case anything that requires database
* during the initial transaction in case anything that requires database
* access needs to be done .
* access needs to be done .
*/
*/
if ( load_session_libraries )
if ( ( flags & INIT_PG_LOAD_SESSION_LIBS ) ! = 0 )
process_session_preload_libraries ( ) ;
process_session_preload_libraries ( ) ;
/* report this backend in the PgBackendStatus array */
/* report this backend in the PgBackendStatus array */