diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c index 5f1726c095..d65bf47d77 100644 --- a/src/backend/catalog/aclchk.c +++ b/src/backend/catalog/aclchk.c @@ -5045,6 +5045,9 @@ pg_database_aclcheck(Oid db_oid, Oid roleid, AclMode mode) AclResult pg_parameter_aclcheck(const char *name, Oid roleid, AclMode mode) { + /* It's pointless to call this function, unless we're in a transaction. */ + Assert(IsTransactionState()); + if (pg_parameter_aclmask(name, roleid, mode, ACLMASK_ANY) != 0) return ACLCHECK_OK; else diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 8b6b5bbaaa..e63548777e 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -4163,12 +4163,6 @@ PostgresMain(const char *dbname, const char *username) if (am_walsender) InitWalSender(); - /* - * process any libraries that should be preloaded at backend start (this - * likewise can't be done until GUC settings are complete) - */ - process_session_preload_libraries(); - /* * Send this backend's cancellation info to the frontend. */ diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 6b9082604f..29f7adb0a7 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -1108,6 +1108,13 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, /* Initialize this backend's session state. */ InitializeSession(); + /* + * process any libraries that should be preloaded at backend start (this + * can't be done until GUC settings are complete). Note that these libraries + * can declare new GUC variables. + */ + process_session_preload_libraries(); + /* report this backend in the PgBackendStatus array */ if (!bootstrap) pgstat_bestart();