Re: PostgreSQL in Windows console and Ctrl-C - Mailing list pgsql-hackers

From Robert Haas
Subject Re: PostgreSQL in Windows console and Ctrl-C
Date
Msg-id CA+TgmoZ3aKE4EnCTmQmZSyKC_0pjL_u4C_x47GE48uY1upBNxg@mail.gmail.com
Whole thread Raw
In response to Re: PostgreSQL in Windows console and Ctrl-C  (Christian Ullrich <chris@chrullrich.net>)
List pgsql-hackers
On Tue, Apr 15, 2014 at 2:23 PM, Christian Ullrich <chris@chrullrich.net> wrote:
> * From: Robert Haas
>> On Mon, Apr 14, 2014 at 2:16 AM, Christian Ullrich
>> <chris@chrullrich.net> wrote:
>
>> > I meant creating a new one, yes. If, say, PGSQL_BACKGROUND_JOB was
>> > set, the postmaster etc. would ignore the events.
>>
>> Why not just pass a command-line switch?
>
> Because, as I wrote in the message you are quoting, I did not think that
> having a command-line option for the sole purpose of telling the
> postmaster who its parent is was a suitable solution.

True, but you didn't say why, which is what I asked.  You just said
you didn't think it was a good idea, without elaborating.

> While I have you here, though, any suggestions on what the name of that
> option should be? I think --background is about right. Also, how should
> I treat the option on non-Windows platforms? Should it just not be there
> (= error), or be ignored if present?

Well, we had a recent discussion that's related to this, about a
not-entirely-dissimilar problem on Solaris:

http://www.postgresql.org/message-id/22636.1392419221@sss.pgh.pa.us

The proposal there was --daemonize.  That seems somehow inapposite for
Windows, though.  I don't really have a strong opinion at this point
on what the best naming is; I don't love --background, but I haven't
got a better idea, either.

On the topic of how the option should be handled on non-Windows
platforms, I guess I'd vote for accepting it and ignoring it.  The
Solaris issue can (and, IMHO, should) be fixed by teaching pg_ctl to
use fork()+exec()+setsid() rather than system()+hope the shell behaves
the way we'd like, so we don't currently have an apparent need for any
special handling for this case on any platform other than Windows.
But that could change in the future, so I think it'd be smart to
choose a somewhat generic option name and just define it as a no-op on
non-Windows platforms for now.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: bgworker crashed or not?
Next
From: Robert Haas
Date:
Subject: Re: bgworker crashed or not?