pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Josh Kupershmidt <schmiddy@gmail.com>
Cc: Pg Bugs <pgsql-bugs@postgresql.org>
Subject: Re: 'pg_ctl restart' confused about pathname to postgresql.conf
Date: Sat, 22 Oct 2011 12:13:45 -0400
Message-ID: <9475.1319300025@sss.pgh.pa.us> (raw)
In-Reply-To: <CAK3UJRGABxWSOCXnAsSYw5BfR4D9ageXF+6GtsRVm-LtfWfW=g@mail.gmail.com>
References: <CAK3UJRGABxWSOCXnAsSYw5BfR4D9ageXF+6GtsRVm-LtfWfW=g@mail.gmail.com>

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



view thread (4+ messages)  latest in thread

Message-ID: <9475.1319300025@sss.pgh.pa.us>
Permalink:  ../9475.1319300025@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9475.1319300025@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, schmiddy@gmail.com
  Subject: Re: 'pg_ctl restart' confused about pathname to postgresql.conf
  In-Reply-To: <9475.1319300025@sss.pgh.pa.us>
  References: <CAK3UJRGABxWSOCXnAsSYw5BfR4D9ageXF+6GtsRVm-LtfWfW=g@mail.gmail.com> <9475.1319300025@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox