0

My database starts fine, I can connect to it from pgAdmin and run queries. However when I go to Tools->Server Configuration->postgresql.conf I get an error. The error states

could not stat file "postgresql.conf": No such file or directory
CONTEXT: SQL function "pg_file_length" statement 1.
STATEMENT: SELECT pg_file_read('postgresql.conf', 0, pg_file_length('postgresql.conf'))

I tried to run that statement as its own query and came up with no such function. I googled around and found that I need adminpack so I installed that. Now when I run the same query I get `could not open file "postgresql.conf" for reading: No such file or directory.

The file does indeed exist at /etc/postgresql/9.4/main/ so I put the full path in the command and it tells me that absolute paths aren't allowed. I made a symlink in my data directory /var/lib/postgresql/9.4/main of the postgresql.conf file. Doing that allows me to open postgresql.conf from pgamin. However, when I save the file I notice that I get a new postgresql.conf in my data directory and that it renames the symlink to postgresql.conf.bak which means when I have conflicting postgresql.conf files between the /etc/.../main and the /var/.../main directories.

One thought is to move all the .conf files from the /etc/ directory to the /var/ and then put symlinks in the /etc/ but I figure I should just ask rather than screw around.

2
  • I've solved it for postgresql.conf but not pg_hba.conf, I just symlinked the postgresql.conf to the correct location for PGAdmin Mar 15, 2016 at 15:22
  • 1
    @Jamesking56 I just gave up and edit it in nano Mar 15, 2016 at 15:26

1 Answer 1

-1

pg_hba and postgresql.conf should stay under

/etc/postgresql/[pg_version]/main/

then you should link them to /var/lib.. with:

#:ln -s /etc/postgresql/[pg_version]/main/pg_hba.conf
/var/lib/postgresql/[pg_version]/main/pg_hba.conf
1
  • This doesn't answer the question. This is exactly what the asker is doing. Jan 12, 2018 at 9:39

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.