Re: 'pg_ctl restart' confused about pathname to postgresql.conf - Mailing list pgsql-bugs

From Tom Lane
Subject Re: 'pg_ctl restart' confused about pathname to postgresql.conf
Date
Msg-id 9475.1319300025@sss.pgh.pa.us
Whole thread Raw
In response to 'pg_ctl restart' confused about pathname to postgresql.conf  (Josh Kupershmidt <schmiddy@gmail.com>)
Responses Re: 'pg_ctl restart' confused about pathname to postgresql.conf  (Josh Kupershmidt <schmiddy@gmail.com>)
List pgsql-bugs
Josh Kupershmidt <schmiddy@gmail.com> writes:
> 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.

I think the reason it has a problem is that this is what's left in
postmaster.opts:

/home/tgl/pgsql/bin/postgres "-D" "baz"

(which is an accurate representation of the command line from startup)
and that -D switch gets fed to the postmaster as-is during restart.

By and large, I would not recommend using a relative pathname to start
the postmaster, unless you plan to start it from the same working
directory every time.

We could possibly avoid this by having pg_ctl try to absolute-ify the -D
setting during postmaster start, but I'm not convinced it's worth the
trouble, or even that it's appropriate for pg_ctl to editorialize on the
user's choice of absolute vs relative path.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #6264: Superuser does not have inherent Replication permission
Next
From: Josh Kupershmidt
Date:
Subject: Re: 'pg_ctl restart' confused about pathname to postgresql.conf