我尝试通过 ALTER ROLE all SET local_preload_libraries TO fdafd; 修改配置,退出之后,我尝试重新登录时遇到如下问题(这里仅供测试,不要在生成环境这样操作,修改用户或数据库参数时,请确保参数的合法性)。
1 2
$ psql postgres psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: could not access file "$libdir/plugins/fdafd": No such file or directory
/* * Load GUC settings from pg_db_role_setting. * * We try specific settings for the database/role combination, as well as * general for this database and for this user. */ staticvoid process_settings(Oid databaseid, Oid roleid) { Relation relsetting; Snapshot snapshot;
void InitPostgres(constchar *in_dbname, Oid dboid, constchar *username, Oid useroid, bool load_session_libraries, bool override_allow_connections, char *out_dbname) { [...]
/* * Now process any command-line switches and any additional GUC variable * settings passed in the startup packet. We couldn't do this before * because we didn't know if client is a superuser. */ if (MyProcPort != NULL) process_startup_options(MyProcPort, am_superuser);
/* Process pg_db_role_setting options */ process_settings(MyDatabaseId, GetSessionUserId());
[...]
/* * If this is an interactive session, load any libraries that should be * preloaded at backend start. Since those are determined by GUCs, this * can't happen until GUC settings are complete, but we want it to happen * during the initial transaction in case anything that requires database * access needs to be done. */ if (load_session_libraries) process_session_preload_libraries();