Long options for pg_ctl waiting

Lists: pgsql-hackers
From: Vik Fearing <vik(at)2ndquadrant(dot)fr>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Long options for pg_ctl waiting
Date: 2016-09-03 20:57:08
Message-ID: f4ee16cf-27d7-d71a-efb5-1c08c6a2627a@2ndquadrant.fr
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

One thing that has been irking me ever since I came to PostgreSQL is the
fact that pg_ctl -w (and -W) don't have longhand equivalents. I like to
use the long version in scripts and such as extra documentation, and
I've never been able to with these. What's more, I keep forgetting that
--wait (and --no-wait) aren't a thing.

Trivial patch attached.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

Attachment Content-Type Size
pg_ctl_wait-01.patch invalid/octet-stream 1.9 KB

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Vik Fearing <vik(at)2ndquadrant(dot)fr>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-09-03 23:13:59
Message-ID: CAB7nPqT+6cr-yJJ8mTmd=N7gKs+TV8eO7UtHBccgKdGxEQ02WQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Sep 4, 2016 at 5:57 AM, Vik Fearing <vik(at)2ndquadrant(dot)fr> wrote:
> One thing that has been irking me ever since I came to PostgreSQL is the
> fact that pg_ctl -w (and -W) don't have longhand equivalents. I like to
> use the long version in scripts and such as extra documentation, and
> I've never been able to with these. What's more, I keep forgetting that
> --wait (and --no-wait) aren't a thing.
>
> Trivial patch attached.

Nit: Like --nosync we could use --nowait, without an hyphen.
--
Michael


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Vik Fearing <vik(at)2ndquadrant(dot)fr>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-09-07 19:31:13
Message-ID: CA+Tgmob_VRVeKh_c-b0J_AUKz3x_mqvG+dWTeu_RRNL1BWU5pw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On Sat, Sep 3, 2016 at 7:13 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Sun, Sep 4, 2016 at 5:57 AM, Vik Fearing <vik(at)2ndquadrant(dot)fr> wrote:
>> One thing that has been irking me ever since I came to PostgreSQL is the
>> fact that pg_ctl -w (and -W) don't have longhand equivalents. I like to
>> use the long version in scripts and such as extra documentation, and
>> I've never been able to with these. What's more, I keep forgetting that
>> --wait (and --no-wait) aren't a thing.
>>
>> Trivial patch attached.
>
> Nit: Like --nosync we could use --nowait, without an hyphen.

But is that actually better? I think that the idea of omitting the
dash here is one of those things that sounds good at first, and then
later you realize that it was actually a dumb idea all along. If
somebody has an option for --body or --on or --table and has to negate
it by running --nobody or --noon or --notable, some confusion may
result, because in each case you get a word that is not really the
logical inverse of the original option. Also, if you end up with any
multi-word options, like --save-backup-files, then users wonder why
the opposite, --nosave-backup-files, has a dash between words 2 and 3
and between words 3 and 4, but not between words 1 and 2. I suggest
we'd do better to standardize on always including a dash in such
cases.

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


From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Vik Fearing <vik(at)2ndquadrant(dot)fr>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-09-07 19:38:28
Message-ID: 9fbc9667-ea0b-97e9-137d-b0a75efa9faa@archidevsys.co.nz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 08/09/16 07:31, Robert Haas wrote:
> On Sat, Sep 3, 2016 at 7:13 PM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> On Sun, Sep 4, 2016 at 5:57 AM, Vik Fearing <vik(at)2ndquadrant(dot)fr> wrote:
>>> One thing that has been irking me ever since I came to PostgreSQL is the
>>> fact that pg_ctl -w (and -W) don't have longhand equivalents. I like to
>>> use the long version in scripts and such as extra documentation, and
>>> I've never been able to with these. What's more, I keep forgetting that
>>> --wait (and --no-wait) aren't a thing.
>>>
>>> Trivial patch attached.
>> Nit: Like --nosync we could use --nowait, without an hyphen.
> But is that actually better? I think that the idea of omitting the
> dash here is one of those things that sounds good at first, and then
> later you realize that it was actually a dumb idea all along. If
> somebody has an option for --body or --on or --table and has to negate
> it by running --nobody or --noon or --notable, some confusion may
> result, because in each case you get a word that is not really the
> logical inverse of the original option. Also, if you end up with any
> multi-word options, like --save-backup-files, then users wonder why
> the opposite, --nosave-backup-files, has a dash between words 2 and 3
> and between words 3 and 4, but not between words 1 and 2. I suggest
> we'd do better to standardize on always including a dash in such
> cases.
>
+1

possibly '--nosync' (& any similar) should have a '--no-sync' variation
added, with the '--nosync' variation documented as depreciated?

Cheers,
Gavin


From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Vik Fearing <vik(at)2ndquadrant(dot)fr>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-09-07 20:41:57
Message-ID: 20160907204157.GA162322@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Gavin Flower wrote:

> possibly '--nosync' (& any similar) should have a '--no-sync' variation
> added, with the '--nosync' variation documented as depreciated?

I agree -- I would go as far as just documenting --no-sync only and
keeping the --nosync one working with minimal (if any) visibility in
docs.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


From: Vik Fearing <vik(at)2ndquadrant(dot)fr>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-09-07 21:08:05
Message-ID: 74341bf2-6058-2ed8-3075-adfd6f0bc0a3@2ndquadrant.fr
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 09/07/2016 10:41 PM, Alvaro Herrera wrote:
> Gavin Flower wrote:
>
>> possibly '--nosync' (& any similar) should have a '--no-sync' variation
>> added, with the '--nosync' variation documented as depreciated?
>
> I agree -- I would go as far as just documenting --no-sync only and
> keeping the --nosync one working with minimal (if any) visibility in
> docs.

Okay, here's a patch to do that. I don't think it's the other patch's
job to do it.

I also changed --noclean to --no-clean, and --no-locale was already correct.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

Attachment Content-Type Size
pg_ctl_no_opts_01.patch invalid/octet-stream 2.6 KB

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Vik Fearing <vik(at)2ndquadrant(dot)fr>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-09-07 21:39:19
Message-ID: ab448e68-6420-84e1-f3a9-3d1fb4ef8bb2@archidevsys.co.nz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 08/09/16 09:08, Vik Fearing wrote:
> On 09/07/2016 10:41 PM, Alvaro Herrera wrote:
>> Gavin Flower wrote:
>>
>>> possibly '--nosync' (& any similar) should have a '--no-sync' variation
>>> added, with the '--nosync' variation documented as depreciated?
>> I agree -- I would go as far as just documenting --no-sync only and
>> keeping the --nosync one working with minimal (if any) visibility in
>> docs.
> Okay, here's a patch to do that. I don't think it's the other patch's
> job to do it.
>
> I also changed --noclean to --no-clean, and --no-locale was already correct.

Suggest a comment along the lines "Where flags of the form --xxx have a
negated form, then the preferred negated form is --no-xxx - and that any
existing use of the form --noxxx should be converted to --no-xxx, as the
non hyphenated form is now deprecated & will be removed in a future
version of Postgres."

Possibly generate warningswhen the non hyphenated form is used?

Cheers,
Gavin


From: Vik Fearing <vik(at)2ndquadrant(dot)fr>
To: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-09-07 22:57:15
Message-ID: 71015f28-7549-2c33-f9f1-a7a24b7645d9@2ndquadrant.fr
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 09/07/2016 11:39 PM, Gavin Flower wrote:
> On 08/09/16 09:08, Vik Fearing wrote:
>> On 09/07/2016 10:41 PM, Alvaro Herrera wrote:
>>> Gavin Flower wrote:
>>>
>>>> possibly '--nosync' (& any similar) should have a '--no-sync' variation
>>>> added, with the '--nosync' variation documented as depreciated?
>>> I agree -- I would go as far as just documenting --no-sync only and
>>> keeping the --nosync one working with minimal (if any) visibility in
>>> docs.
>> Okay, here's a patch to do that. I don't think it's the other patch's
>> job to do it.
>>
>> I also changed --noclean to --no-clean, and --no-locale was already
>> correct.
>
> Suggest a comment along the lines "Where flags of the form --xxx have a
> negated form, then the preferred negated form is --no-xxx - and that any
> existing use of the form --noxxx should be converted to --no-xxx, as the
> non hyphenated form is now deprecated & will be removed in a future
> version of Postgres."

I have verified that these are the only two options anywhere in the tree
that start with "no" and not "no-" so it should be pretty easy for
future options to conform on their own. I don't see adding a comment
like this to every long option definition block to be very helpful, and
only adding it to initdb is just weird. So I don't see the need for it.

> Possibly generate warningswhen the non hyphenated form is used?

I'm not quite sure how I got volunteered to do this work, but it's easy
enough so I don't mind.

Here is a new patch that emits a warning when --noclean and/or --nosync
are used.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

Attachment Content-Type Size
initdb_no_opts_02.patch invalid/octet-stream 2.9 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vik Fearing <vik(at)2ndquadrant(dot)fr>
Cc: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-09-07 23:05:49
Message-ID: 4125.1473289549@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Vik Fearing <vik(at)2ndquadrant(dot)fr> writes:
> On 09/07/2016 11:39 PM, Gavin Flower wrote:
>> Possibly generate warningswhen the non hyphenated form is used?

> I'm not quite sure how I got volunteered to do this work, but it's easy
> enough so I don't mind.
> Here is a new patch that emits a warning when --noclean and/or --nosync
> are used.

I'm pretty much -1 on printing a warning. There's no ambiguity, and no
real reason for us ever to remove the old spellings. Standardizing on
"no-" going forward makes sense, but let's not slap people's wrists for
existing usage. (Or: if it ain't broke, don't break it.)

regards, tom lane


From: Vik Fearing <vik(at)2ndquadrant(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-09-07 23:46:03
Message-ID: 1607d014-3de8-cb05-a2d6-7645ac40c1f3@2ndquadrant.fr
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 09/08/2016 01:05 AM, Tom Lane wrote:
> Vik Fearing <vik(at)2ndquadrant(dot)fr> writes:
>> On 09/07/2016 11:39 PM, Gavin Flower wrote:
>>> Possibly generate warningswhen the non hyphenated form is used?
>
>> I'm not quite sure how I got volunteered to do this work, but it's easy
>> enough so I don't mind.
>> Here is a new patch that emits a warning when --noclean and/or --nosync
>> are used.
>
> I'm pretty much -1 on printing a warning. There's no ambiguity, and no
> real reason for us ever to remove the old spellings. Standardizing on
> "no-" going forward makes sense, but let's not slap people's wrists for
> existing usage. (Or: if it ain't broke, don't break it.)

One could also argue that 2 out of 53 "no" options omitting the dash is
in fact broken, and a real reason to remove them.

I don't see the warning as "slapping wrists" so much as saying that
we're harmonizing our conventions and their scripts need to be updated
for the better.

That said, I'm not going to fight for this. My only goal here is to get
--wait and --no-wait added to pg_ctl.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vik Fearing <vik(at)2ndquadrant(dot)fr>
Cc: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-09-07 23:56:31
Message-ID: 10458.1473292591@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Vik Fearing <vik(at)2ndquadrant(dot)fr> writes:
> On 09/08/2016 01:05 AM, Tom Lane wrote:
>> I'm pretty much -1 on printing a warning. There's no ambiguity, and no
>> real reason for us ever to remove the old spellings. Standardizing on
>> "no-" going forward makes sense, but let's not slap people's wrists for
>> existing usage. (Or: if it ain't broke, don't break it.)

> One could also argue that 2 out of 53 "no" options omitting the dash is
> in fact broken, and a real reason to remove them.

I do not buy that. As a counter argument, consider that removing them
would make it impossible to write a script that works with both old
and new versions of PG. That's a mighty high price to pay for what
is little more than pedantry.

regards, tom lane


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, Robert Haas <robertmhaas(at)gmail(dot)com>, Vik Fearing <vik(at)2ndquadrant(dot)fr>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-09-08 00:00:13
Message-ID: CAB7nPqSkZi9WUts_uJj3bZ8CDtF8hVuAQiNRT9jHd4xwOWRQOw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Sep 8, 2016 at 5:41 AM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
> Gavin Flower wrote:
>
>> possibly '--nosync' (& any similar) should have a '--no-sync' variation
>> added, with the '--nosync' variation documented as depreciated?
>
> I agree -- I would go as far as just documenting --no-sync only and
> keeping the --nosync one working with minimal (if any) visibility in
> docs.

Keeping no visibility at all in the docs, with an alias in the
binaries sounds fine to me if we want to standardize a bit more
things.
--
Michael


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Vik Fearing <vik(at)2ndquadrant(dot)fr>, Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-09-08 00:05:45
Message-ID: CAB7nPqRk41Ymz82pqA5i0oZxzajGKbWp6w8DRPH349fRjiHMMw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Sep 8, 2016 at 8:56 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Vik Fearing <vik(at)2ndquadrant(dot)fr> writes:
>> On 09/08/2016 01:05 AM, Tom Lane wrote:
>>> I'm pretty much -1 on printing a warning. There's no ambiguity, and no
>>> real reason for us ever to remove the old spellings. Standardizing on
>>> "no-" going forward makes sense, but let's not slap people's wrists for
>>> existing usage. (Or: if it ain't broke, don't break it.)
>
>> One could also argue that 2 out of 53 "no" options omitting the dash is
>> in fact broken, and a real reason to remove them.
>
> I do not buy that. As a counter argument, consider that removing them
> would make it impossible to write a script that works with both old
> and new versions of PG. That's a mighty high price to pay for what
> is little more than pedantry.

Perhaps discussing that on another thread would be better, and I was
the one who began this thing... So I'll do it.

Vik's stuff is just to add a --no-wait and --wait long option alias on
pg_ctl. And that clearly improves the readability for users, so that's
a +1 from here. And let's just use the v1 presented at the beginning
of this thread. I agree with the feeling that standardizing things
would be better btw for such option names.
--
Michael


From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Vik Fearing <vik(at)2ndquadrant(dot)fr>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-10-19 12:50:45
Message-ID: 20edbf34-cbd2-50f4-4eea-2904a0888a41@2ndquadrant.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 9/3/16 4:57 PM, Vik Fearing wrote:
> One thing that has been irking me ever since I came to PostgreSQL is the
> fact that pg_ctl -w (and -W) don't have longhand equivalents. I like to
> use the long version in scripts and such as extra documentation, and
> I've never been able to with these. What's more, I keep forgetting that
> --wait (and --no-wait) aren't a thing.

committed

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Vik Fearing <vik(at)2ndquadrant(dot)fr>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Long options for pg_ctl waiting
Date: 2016-10-19 12:51:10
Message-ID: ed65c9ff-a376-eff6-c54e-15288889099e@2ndquadrant.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 9/7/16 5:08 PM, Vik Fearing wrote:
> On 09/07/2016 10:41 PM, Alvaro Herrera wrote:
>> Gavin Flower wrote:
>>
>>> possibly '--nosync' (& any similar) should have a '--no-sync' variation
>>> added, with the '--nosync' variation documented as depreciated?
>>
>> I agree -- I would go as far as just documenting --no-sync only and
>> keeping the --nosync one working with minimal (if any) visibility in
>> docs.
>
> Okay, here's a patch to do that. I don't think it's the other patch's
> job to do it.
>
> I also changed --noclean to --no-clean, and --no-locale was already correct.

committed

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services