I accidentally ran
ALTER DATABASE mydb SET session_preload_libraries = ''; -- empty string
and now I can't log in to my PostgreSQL (v.14) database. I'm getting
[58P01] FATAL: could not access file "": No such file or directory
Is there any way to fix this? I can't execute any command because of this error
3 Answers 3
Connect to some other database, like 'postgres' or 'template1', and reset the parameter.
If there are no other databases you can connect to, then you might need to restart the cluster in --single mode to fix it.
The session_preload_libraries setting should be in a postgresql.auto.conf file of your cluster's data directory. Edit that file and restart the cluster to fix the problem.
-
Please explain what setting?Rohit Gupta– Rohit Gupta2023年09月26日 09:08:16 +00:00Commented Sep 26, 2023 at 9:08
-
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.2023年09月26日 09:08:23 +00:00Commented Sep 26, 2023 at 9:08
-
This is for sure the easiest answer. No need to go through any hoops other than just editing the mentioned file. Just saved me a ton of headache, thanks!Thermostat– Thermostat2025年09月21日 14:32:50 +00:00Commented Sep 21 at 14:32
Sorry for the late answer, but better late then never...
Resetting session_preload_libraries is done by running
ALTER DATABASE <YOUR_DATABASE> RESET session_preload_libraries;
Hope it helps.
-
How's that gonna help if the OP can't connect to the database?mustaccio– mustaccio2024年10月31日 13:20:56 +00:00Commented Oct 31, 2024 at 13:20
-
@mustaccio: as jjanes pointed "Connect to some other database, like 'postgres' or 'template1'". Have you even tried this before you downvoted?!?hobbyhobs– hobbyhobs2024年11月01日 14:57:17 +00:00Commented Nov 1, 2024 at 14:57