BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory

Lists: pgsql-bugs
From: "Michael Renner" <michael(dot)renner(at)amd(dot)co(dot)at>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory
Date: 2009-10-08 00:26:16
Message-ID: 200910080026.n980QG14085171@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5103
Logged by: Michael Renner
Email address: michael(dot)renner(at)amd(dot)co(dot)at
PostgreSQL version: HEAD
Operating system: Linux
Description: "pg_ctl -w (re)start" fails with custom
unix_socket_directory
Details:

When using a non-standard unix_socket_directory setting, pg_ctl -w (re)start
fails because it checks for the socket file to appear in it's default
location.


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Michael Renner <michael(dot)renner(at)amd(dot)co(dot)at>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory
Date: 2009-10-08 00:45:51
Message-ID: 20091008004551.GQ7719@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Michael Renner wrote:

> When using a non-standard unix_socket_directory setting, pg_ctl -w (re)start
> fails because it checks for the socket file to appear in it's default
> location.

Yeah, this has been discussed before. It's been suggested that pg_ctl
should parse postgresql.conf to figure out the settings, but no one has
gotten around to it. Feel free to give it a whirl if you're so inclined.

Hmm, another idea would be to have a new postmaster switch that would
report the value of any given configuration option. So pg_ctl wouldn't
have to get into the business of parsing the config file, but would
simply ask postmaster for the value (which already knows how to parse
the file).

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Michael Renner <michael(dot)renner(at)amd(dot)co(dot)at>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory
Date: 2009-10-08 03:03:24
Message-ID: 13168.1254971004@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Michael Renner wrote:
>> When using a non-standard unix_socket_directory setting, pg_ctl -w (re)start
>> fails because it checks for the socket file to appear in it's default
>> location.

> Yeah, this has been discussed before. It's been suggested that pg_ctl
> should parse postgresql.conf to figure out the settings, but no one has
> gotten around to it. Feel free to give it a whirl if you're so inclined.

> Hmm, another idea would be to have a new postmaster switch that would
> report the value of any given configuration option. So pg_ctl wouldn't
> have to get into the business of parsing the config file, but would
> simply ask postmaster for the value (which already knows how to parse
> the file).

Neither of those things would fully fix the problem anyway; consider the
possibility that the actual setting came from someplace else, eg the
postmaster command line, or that the current contents of postgresql.conf
are out of sync with the postmaster's actual values (hardly unlikely for
a PGC_POSTMASTER setting). This is not an easy thing to fix.

My current feeling about it is that setting unix_socket_directory as a
configuration parameter is only useful to those who are deliberately
trying to hide their postmaster from regular clients, in which case
the fact that pg_ctl -w fails could be seen as a feature not a bug.
The way to make it work is of course the same as for any other
client, eg put PGHOST=/socket/directory in your environment.

If you want an actually convenient-to-use setup with a nonstandard
socket directory, the way to do it is to set the socket directory at
build time (see DEFAULT_PGSOCKET_DIR). Then you'll have a libpq that
knows where to look, and the pg_ctl issue goes away.

regards, tom lane


From: Michael Renner <michael(dot)renner(at)amd(dot)co(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory
Date: 2009-10-08 19:32:34
Message-ID: 4ACE3E52.9060907@amd.co.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane wrote:

> My current feeling about it is that setting unix_socket_directory as a
> configuration parameter is only useful to those who are deliberately
> trying to hide their postmaster from regular clients, in which case
> the fact that pg_ctl -w fails could be seen as a feature not a bug.
> The way to make it work is of course the same as for any other
> client, eg put PGHOST=/socket/directory in your environment.

Thanks, that is exactly what I wanted to achieve and setting PGHOST
accordingly works fine. Mentioning PGHOST in pg_ctl's
manpage/documentation should make this entirely clear for people who
aren't familiar with the extensive environment variables PostgreSQLs
client library can use. [1]

If this is a viable option I can write a small patch against the
documentation.

> If you want an actually convenient-to-use setup with a nonstandard
> socket directory, the way to do it is to set the socket directory at
> build time (see DEFAULT_PGSOCKET_DIR). Then you'll have a libpq that
> knows where to look, and the pg_ctl issue goes away.

That'd be also a good alternative for my use case, but I think I'll
stick with PGHOST for now.

best regards,
Michael

[1] I was under the impression that they were psql(1)-specific...


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Michael Renner <michael(dot)renner(at)amd(dot)co(dot)at>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory
Date: 2009-10-08 19:36:37
Message-ID: 20091008193637.GF5510@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Michael Renner wrote:

> Mentioning PGHOST in pg_ctl's
> manpage/documentation should make this entirely clear for people who
> aren't familiar with the extensive environment variables PostgreSQLs
> client library can use. [1]

Yeah, this has been complained about many, many times.

> If this is a viable option I can write a small patch against the
> documentation.

I think the patch we need here is something that creates a separate
manpage for the libpq environment variables, and some kind of note in
each and every libpq-using program referring the user to that page.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: Michael Renner <michael(dot)renner(at)amd(dot)co(dot)at>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory
Date: 2009-10-08 19:45:53
Message-ID: 4ACE4171.5050205@amd.co.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Alvaro Herrera wrote:
> Michael Renner wrote:
>
>> Mentioning PGHOST in pg_ctl's
>> manpage/documentation should make this entirely clear for people who
>> aren't familiar with the extensive environment variables PostgreSQLs
>> client library can use. [1]
>
> Yeah, this has been complained about many, many times.

Usually an indicator that it need's fixing, eh? ;)

>> If this is a viable option I can write a small patch against the
>> documentation.
>
> I think the patch we need here is something that creates a separate
> manpage for the libpq environment variables, and some kind of note in
> each and every libpq-using program referring the user to that page.

Looking through the available variables probably only PGHOST seems to be
of interest for pg_ctl's purposes; psql's manpage already refers to The
Documentation for further variables and information. What's needed in
pg_ctl's case is just a pointer for the uninformed, at least for me
that'd have sufficed.

best regards,
Michael


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Michael Renner <michael(dot)renner(at)amd(dot)co(dot)at>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory
Date: 2009-10-09 21:45:59
Message-ID: 200910092145.n99Ljxi26767@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane wrote:
> My current feeling about it is that setting unix_socket_directory as a
> configuration parameter is only useful to those who are deliberately
> trying to hide their postmaster from regular clients, in which case
> the fact that pg_ctl -w fails could be seen as a feature not a bug.
> The way to make it work is of course the same as for any other
> client, eg put PGHOST=/socket/directory in your environment.

Is this current TODO item incorrect? Should it be removed?

Have pg_ctl look at PGHOST in case it is a socket directory?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Michael Renner <michael(dot)renner(at)amd(dot)co(dot)at>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory
Date: 2009-10-10 02:35:06
Message-ID: 5165.1255142106@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Tom Lane wrote:
>> My current feeling about it is that setting unix_socket_directory as a
>> configuration parameter is only useful to those who are deliberately
>> trying to hide their postmaster from regular clients, in which case
>> the fact that pg_ctl -w fails could be seen as a feature not a bug.
>> The way to make it work is of course the same as for any other
>> client, eg put PGHOST=/socket/directory in your environment.

> Is this current TODO item incorrect? Should it be removed?

> Have pg_ctl look at PGHOST in case it is a socket directory?

I dunno why that's there, but it sure *looks* like it's clueless
about the actual behavior of pg_ctl ...

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Michael Renner <michael(dot)renner(at)amd(dot)co(dot)at>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory
Date: 2009-10-10 10:08:49
Message-ID: 200910101008.n9AA8nm21003@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > Tom Lane wrote:
> >> My current feeling about it is that setting unix_socket_directory as a
> >> configuration parameter is only useful to those who are deliberately
> >> trying to hide their postmaster from regular clients, in which case
> >> the fact that pg_ctl -w fails could be seen as a feature not a bug.
> >> The way to make it work is of course the same as for any other
> >> client, eg put PGHOST=/socket/directory in your environment.
>
> > Is this current TODO item incorrect? Should it be removed?
>
> > Have pg_ctl look at PGHOST in case it is a socket directory?
>
> I dunno why that's there, but it sure *looks* like it's clueless
> about the actual behavior of pg_ctl ...

Thanks, removed.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Michael Renner <michael(dot)renner(at)amd(dot)co(dot)at>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory
Date: 2010-02-22 22:38:38
Message-ID: 201002222238.o1MMccW25355@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Michael Renner wrote:
> Alvaro Herrera wrote:
> > Michael Renner wrote:
> >
> >> Mentioning PGHOST in pg_ctl's
> >> manpage/documentation should make this entirely clear for people who
> >> aren't familiar with the extensive environment variables PostgreSQLs
> >> client library can use. [1]
> >
> > Yeah, this has been complained about many, many times.
>
> Usually an indicator that it need's fixing, eh? ;)
>
> >> If this is a viable option I can write a small patch against the
> >> documentation.
> >
> > I think the patch we need here is something that creates a separate
> > manpage for the libpq environment variables, and some kind of note in
> > each and every libpq-using program referring the user to that page.
>
> Looking through the available variables probably only PGHOST seems to be
> of interest for pg_ctl's purposes; psql's manpage already refers to The
> Documentation for further variables and information. What's needed in
> pg_ctl's case is just a pointer for the uninformed, at least for me
> that'd have sufficed.

Based on your suggestion, I have documented the use of PGHOST by pg_ctl
with the attached patch. I specifically mentioned the socket location.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
PG East: http://www.enterprisedb.com/community/nav-pg-east-2010.do
+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 1.9 KB

From: Michael Renner <michael(dot)renner(at)amd(dot)co(dot)at>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory
Date: 2010-02-23 13:22:14
Message-ID: 4B83D686.8020809@amd.co.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On 22.02.2010 23:38, Bruce Momjian wrote:
> Michael Renner wrote:
>
>> Looking through the available variables probably only PGHOST seems to be
>> of interest for pg_ctl's purposes; psql's manpage already refers to The
>> Documentation for further variables and information. What's needed in
>> pg_ctl's case is just a pointer for the uninformed, at least for me
>> that'd have sufficed.
>
> Based on your suggestion, I have documented the use of PGHOST by pg_ctl
> with the attached patch. I specifically mentioned the socket location.

Thanks, highly appreciated!

best regards,
Michael Renner