Re: PostgreSQL in Windows console and Ctrl-C

From: "MauMau" <maumau307(at)gmail(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>, "Christian Ullrich" <chris(at)chrullrich(dot)net>
Subject: Re: PostgreSQL in Windows console and Ctrl-C
Date: 2014-06-21 06:45:46
Message-ID: 849EA8FF69D049CAB5392AF5EBE4E1AF@maumau
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: "Christian Ullrich" <chris(at)chrullrich(dot)net>
> OK, here is the first draft against current master. It builds on Windows
> with VS 2012 and on FreeBSD 10 with clang 3.3. I ran the regression
> tests on Windows, they all pass.
>
> The changed behavior is limited to Windows, where it now silently
> ignores Ctrl-C and Ctrl-Break when started via pg_ctl start.
>
> I don't think there is currently any support for switch-type long
> options, so rather than invent my own, I squeezed the two lines I added
> into postmaster.c where they fit best; unfortunately, the result is
> quite ugly. I'll be happy to refine that if someone can give me a hint
> on how to do it.

Overall, the patch seems good as it is based on the discussion. I found a
few problems:

(1)
The patch doesn't apply to HEAD. Could you rebase your patch?

patching file src/bin/pg_ctl/pg_ctl.c
Hunk #1 FAILED at 453.
1 out of 1 hunk FAILED -- saving rejects to file src/bin/pg_ctl/pg_ctl.c.rej

(2)
Although I haven't tried, doesn't pg_ctl start fail on non-Windows platforms
because of the following check?

! if (opt == '-')
! ereport(ERROR,
! (errcode(ERRCODE_SYNTAX_ERROR),
! errmsg("--%s requires a value",
! optarg)));

And, in the postgres reference page,

http://www.postgresql.org/docs/devel/static/app-postgres.html

there's a paragraph:

"The -- options will not work on FreeBSD or OpenBSD. Use -c instead. This is
a bug in the affected operating systems; a future release of PostgreSQL will
provide a workaround if this is not fixed."

Would --background work on FreeBSD and OpenBSD (i.e. would pg_ctl start
succeed)? I don't have access to those platforms.

(3)
--background will also be used by restart subcommand, won't it?

+ in a console window. It is used automatically by
+ <command>pg_ctl</command> when called with the
+ <option>start</option> subcommand.

Regards
MauMau

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-06-21 10:58:49 Re: crash with assertions and WAL_DEBUG
Previous Message Stephen Frost 2014-06-21 04:08:55 Re: API change advice: Passing plan invalidation info from the rewriter into the planner?