Re: BUG #19042: Option --help not recognized at the end of command line in pg_restore - Mailing list pgsql-bugs

From Daniel Gustafsson
Subject Re: BUG #19042: Option --help not recognized at the end of command line in pg_restore
Date
Msg-id B8FA8D64-5575-41F1-9F3B-DF603495309A@yesql.se
Whole thread Raw
In response to Re: BUG #19042: Option --help not recognized at the end of command line in pg_restore  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: BUG #19042: Option --help not recognized at the end of command line in pg_restore
List pgsql-bugs
> On 22 Oct 2025, at 23:23, Nathan Bossart <nathandbossart@gmail.com> wrote:
>
> On Wed, Sep 10, 2025 at 11:24:36AM +0200, Daniel Gustafsson wrote:
>> I am writing up a patch to move it into long option processing to see
>> what it would look like, will share soon.
>
> Are you still planning to work on this one?

Attached is a v1 which converts all the apps in the tree to allow version and
help arguments at any position.

There was quite the variety of how the help/version arguments were handled,
some apps had partial support in the longopts, some had full support and some
had none.  The idea was to make handling consistent across the binaries without
introducing any dependencies or build time changes.

While hacking on this it seemed like a good idea to move to using progname
consistently, and reduce scope in some places from global variables, but
looking at it now I'm less convinced.  At the very least it should be ripped
out into its own patch but for now those changes are left in there.

It's far from an exciting patchset but it would be nice to get it done once and
for all.  0002 is a small change to make sure all apps exit with the same code,
I was unable to find a documented rationale for exit(2) so I think it's an
oversight.

--
Daniel Gustafsson


Attachment

pgsql-bugs by date:

Previous
From: Gavin Wahl
Date:
Subject: psql --echo-queries does not echo all queries
Next
From: Tom Lane
Date:
Subject: Re: BUG #19094: select statement on postgres 17 vs postgres 18 is returning different/duplicate results