0

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

5

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.

1

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.

3
  • Please explain what setting? Commented 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. Commented 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! Commented Sep 21 at 14:32
-1

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.

2
  • How's that gonna help if the OP can't connect to the database? Commented 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?!? Commented Nov 1, 2024 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.