pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Parallel pg_dump's error reporting doesn't work worth squat
Date: Thu, 26 May 2016 12:15:29 -0400
Message-ID: <8273.1464279329@sss.pgh.pa.us> (raw)
In-Reply-To: <20160526.105701.64908801.horiguchi.kyotaro@lab.ntt.co.jp>
References: <3149.1464149757@sss.pgh.pa.us>
	<20160525.173041.123092921.horiguchi.kyotaro@lab.ntt.co.jp>
	<24577.1464185488@sss.pgh.pa.us>
	<20160526.105701.64908801.horiguchi.kyotaro@lab.ntt.co.jp>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:
> At Wed, 25 May 2016 10:11:28 -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote in <24577.1464185488@sss.pgh.pa.us>
>> The only case
>> that is certain to work is switches before non-switch arguments, and so
>> we should not give any documentation examples in the other order.  On a
>> platform using GNU getopt(), getopt() will rearrange the argv[] array to
>> make such cases work, but non-GNU getopt() doesn't do that (and I don't
>> really trust the GNU version not to get confused, either).

> Yeah, I knew it after reading port/getopt_long.c. But the error
> message seems saying nothing about that (at least to me). And
> those accumstomed to the GNU getopt's behavior will fail to get
> the point of the message. The documentation also doesn't
> explicitly saying about the restriction; it is only implicitly
> shown in synopsis. How about something like the following
> message? (The patch attached looks too dependent on the specific
> behavior of our getopt_long.c, but doing it in getopt_long.c also
> seems to be wrong..)

It's not a bad idea to try to improve our response to this situation,
but I think this patch needs more work.  I wonder in particular why
you're not basing the variant error message on the first unprocessed
argument starting with '-', rather than looking at the word before it.
Another thought is that the message is fairly unhelpful because it does
not show where in the arguments things went wrong.  Maybe something
more like

	if (argv[optind][0] == '-')
		fprintf(stderr, _("%s: misplaced option \"%s\": options must appear before non-option arguments\n"),
			progname, argv[optind]);
	else
		// existing message

In any case, if we wanted to do something about this scenario, we should
do it consistently across all our programs, not just pg_dump.  I count
25 appearances of that "too many command-line arguments" message...

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (33+ messages)  latest in thread

Message-ID: <8273.1464279329@sss.pgh.pa.us>
Permalink:  ../8273.1464279329@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8273.1464279329@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, horiguchi.kyotaro@lab.ntt.co.jp
  Subject: Re: Parallel pg_dump's error reporting doesn't work worth squat
  In-Reply-To: <8273.1464279329@sss.pgh.pa.us>
  References: <3149.1464149757@sss.pgh.pa.us> <20160525.173041.123092921.horiguchi.kyotaro@lab.ntt.co.jp> <24577.1464185488@sss.pgh.pa.us> <20160526.105701.64908801.horiguchi.kyotaro@lab.ntt.co.jp> <8273.1464279329@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox