pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_ctl restart issue with relative paths
4+ messages / 4 participants
[nested] [flat]

* pg_ctl restart issue with relative paths
@ 2012-10-13 22:56 Thom Brown <thom@linux.com>
  2012-10-14 16:56 ` Re: pg_ctl restart issue with relative paths Josh Kupershmidt <schmiddy@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Thom Brown @ 2012-10-13 22:56 UTC (permalink / raw)
  To: pgsql-bugs

Hi,

I have noticed that, using pg_ctl, if you start Postgres using a
relative path, then attempt to restart it from anywhere else, it
fails.

Example:

thom@swift /tmp $ pg_ctl -D primary start
server starting
thom@swift /tmp $ pg_ctl -D primary restart
waiting for server to shut down.... done
server stopped
server starting
thom@swift /tmp $ cd
thom@swift ~ $ pg_ctl -D /tmp/primary restart
waiting for server to shut down.... done
server stopped
server starting
thom@swift ~ $ postgres cannot access the server configuration file
"/home/thom/primary/postgresql.conf": No such file or directory

thom@swift ~ $ cd /tmp/primary
thom@swift /tmp/primary $ pg_ctl -D /tmp/primary restart
pg_ctl: PID file "/tmp/primary/postmaster.pid" does not exist
Is server running?
starting server anyway
server starting
thom@swift /tmp/primary $ postgres cannot access the server
configuration file "/tmp/primary/primary/postgresql.conf": No such
file or directory

thom@swift /tmp/primary $ cd ..
thom@swift /tmp $ pg_ctl -D /tmp/primary restart
pg_ctl: PID file "/tmp/primary/postmaster.pid" does not exist
Is server running?
starting server anyway
server starting


This issue does not occur if stopping then starting.  I suspect the
blame lies with postmaster.opts not storing the resolved absolute
path.

OS: Linux Mint 13 64-bit
PostgreSQL version: 9.1.6 at least (just the stable version I tested
on), and git master

-- 
Thom




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_ctl restart issue with relative paths
  2012-10-13 22:56 pg_ctl restart issue with relative paths Thom Brown <thom@linux.com>
@ 2012-10-14 16:56 ` Josh Kupershmidt <schmiddy@gmail.com>
  2012-10-14 17:07   ` Re: pg_ctl restart issue with relative paths Tom Lane <tgl@sss.pgh.pa.us>
  2012-10-15 19:27   ` Re: pg_ctl restart issue with relative paths Bruce Momjian <bruce@momjian.us>
  0 siblings, 2 replies; 4+ messages in thread

From: Josh Kupershmidt @ 2012-10-14 16:56 UTC (permalink / raw)
  To: Thom Brown <thom@linux.com>; +Cc: pgsql-bugs

On Sat, Oct 13, 2012 at 3:56 PM, Thom Brown <thom@linux.com> wrote:

> I have noticed that, using pg_ctl, if you start Postgres using a
> relative path, then attempt to restart it from anywhere else, it
> fails.

Yeah, I was complaining about the same problem here:
  http://archives.postgresql.org/pgsql-bugs/2011-10/msg00210.php

and at least there's a doc note now warning against using relative
paths, though it sure would be nice if we could fix this gripe.

Josh




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_ctl restart issue with relative paths
  2012-10-13 22:56 pg_ctl restart issue with relative paths Thom Brown <thom@linux.com>
  2012-10-14 16:56 ` Re: pg_ctl restart issue with relative paths Josh Kupershmidt <schmiddy@gmail.com>
@ 2012-10-14 17:07   ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 4+ messages in thread

From: Tom Lane @ 2012-10-14 17:07 UTC (permalink / raw)
  To: Josh Kupershmidt <schmiddy@gmail.com>; +Cc: Thom Brown <thom@linux.com>; pgsql-bugs

Josh Kupershmidt <schmiddy@gmail.com> writes:
> On Sat, Oct 13, 2012 at 3:56 PM, Thom Brown <thom@linux.com> wrote:
>> I have noticed that, using pg_ctl, if you start Postgres using a
>> relative path, then attempt to restart it from anywhere else, it
>> fails.

> Yeah, I was complaining about the same problem here:
>   http://archives.postgresql.org/pgsql-bugs/2011-10/msg00210.php

I just re-read that thread, and it occurred to me that there is another
way to fix the problem: what we need is either for postmaster.opts to
not store the -D option at all, or for pg_ctl restart to override that
option with its freshly-derived idea of where the data directory is.
This would avoid my allergy to the idea of storing an absolute-ified
path, which I'm still down on because it would have failure modes of
its own.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_ctl restart issue with relative paths
  2012-10-13 22:56 pg_ctl restart issue with relative paths Thom Brown <thom@linux.com>
  2012-10-14 16:56 ` Re: pg_ctl restart issue with relative paths Josh Kupershmidt <schmiddy@gmail.com>
@ 2012-10-15 19:27   ` Bruce Momjian <bruce@momjian.us>
  1 sibling, 0 replies; 4+ messages in thread

From: Bruce Momjian @ 2012-10-15 19:27 UTC (permalink / raw)
  To: Josh Kupershmidt <schmiddy@gmail.com>; +Cc: Thom Brown <thom@linux.com>; pgsql-bugs

On Sun, Oct 14, 2012 at 09:56:46AM -0700, Josh Kupershmidt wrote:
> On Sat, Oct 13, 2012 at 3:56 PM, Thom Brown <thom@linux.com> wrote:
> 
> > I have noticed that, using pg_ctl, if you start Postgres using a
> > relative path, then attempt to restart it from anywhere else, it
> > fails.
> 
> Yeah, I was complaining about the same problem here:
>   http://archives.postgresql.org/pgsql-bugs/2011-10/msg00210.php
> 
> and at least there's a doc note now warning against using relative
> paths, though it sure would be nice if we could fix this gripe.

FYI, the doc patch is mentioned here:

	http://archives.postgresql.org/pgsql-bugs/2012-08/msg00133.php

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2012-10-15 19:27 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-10-13 22:56 pg_ctl restart issue with relative paths Thom Brown <thom@linux.com>
2012-10-14 16:56 ` Josh Kupershmidt <schmiddy@gmail.com>
2012-10-14 17:07   ` Tom Lane <tgl@sss.pgh.pa.us>
2012-10-15 19:27   ` Bruce Momjian <bruce@momjian.us>

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