Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id E4123B5DC6A for ; Sat, 22 Oct 2011 13:13:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 67592-06 for ; Sat, 22 Oct 2011 16:13:47 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 3C3B1B5DC69 for ; Sat, 22 Oct 2011 13:13:47 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p9MGDkNt009476; Sat, 22 Oct 2011 12:13:46 -0400 (EDT) To: Josh Kupershmidt cc: Pg Bugs Subject: Re: 'pg_ctl restart' confused about pathname to postgresql.conf In-reply-to: References: Comments: In-reply-to Josh Kupershmidt message dated "Fri, 21 Oct 2011 17:51:28 -0400" Date: Sat, 22 Oct 2011 12:13:45 -0400 Message-ID: <9475.1319300025@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201110/214 X-Sequence-Number: 31484 Josh Kupershmidt 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