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

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Matthias Hörmann <matthias(dot)hoermann(at)saltation(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19042: Option --help not recognized at the end of command line in pg_restore
Date: 2025-10-24 22:26:01
Message-ID: B8FA8D64-5575-41F1-9F3B-DF603495309A@yesql.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On 22 Oct 2025, at 23:23, Nathan Bossart <nathandbossart(at)gmail(dot)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 Content-Type Size
v1-0001-Handle-help-and-version-as-normal-commandline-par.patch application/octet-stream 81.8 KB
v1-0002-Consistently-use-exit-code-1-for-invalid-argument.patch application/octet-stream 1018 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-10-25 14:31:05 Re: BUG #19094: select statement on postgres 17 vs postgres 18 is returning different/duplicate results
Previous Message Gavin Wahl 2025-10-24 18:16:57 psql --echo-queries does not echo all queries