Thread: Long options for pg_ctl waiting
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
On Sun, Sep 4, 2016 at 5:57 AM, Vik Fearing <vik@2ndquadrant.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
On Sat, Sep 3, 2016 at 7:13 PM, Michael Paquier <michael.paquier@gmail.com> wrote: > On Sun, Sep 4, 2016 at 5:57 AM, Vik Fearing <vik@2ndquadrant.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
On 08/09/16 07:31, Robert Haas wrote: > On Sat, Sep 3, 2016 at 7:13 PM, Michael Paquier > <michael.paquier@gmail.com> wrote: >> On Sun, Sep 4, 2016 at 5:57 AM, Vik Fearing <vik@2ndquadrant.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
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
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
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
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
Vik Fearing <vik@2ndquadrant.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
On 09/08/2016 01:05 AM, Tom Lane wrote: > Vik Fearing <vik@2ndquadrant.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
Vik Fearing <vik@2ndquadrant.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
On Thu, Sep 8, 2016 at 5:41 AM, Alvaro Herrera <alvherre@2ndquadrant.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
On Thu, Sep 8, 2016 at 8:56 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Vik Fearing <vik@2ndquadrant.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
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
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