I've noticed that I occasionally see errors from "pg_ctl restart" claiming:
postgres cannot access the server configuration file ... No such
file or directory
depending on what directory I execute "pg_ctl restart" from, and where
the postmaster was originally started from. I boiled this problem down
to the attached test case. I've seen this problem on 9.1.1 and git
head. The testcase was tried on OS X and Debian, with Postgres
installed locally like this:
./configure --prefix=/home/postgres/runtime/ --with-python --enable-debug
You can run the test case stand-alone, though it's probably easier to
see what's going on if you just copy-paste into your terminal: at the
end you should wind up with your current directory "/tmp/foo/". You
should see that the last command, "pg_ctl -D $DATADIR restart" failed
to start the server back up, complaining:
postgres cannot access the server configuration file
"/tmp/foo/baz/postgresql.conf": No such file or directory
even though $DATADIR is clearly set to "/tmp/foo/bar/baz/" (N.B.
directory "bar" has gone missing in the above error message). A
"pg_ctl -D $DATADIR start" should work at this point, though. This
seems like some bug in normalizing the absolute path to
postgresql.conf.
Josh