Re: pg_restore documentation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: wkhatch(at)me(dot)com
Cc: pgsql-docs(at)postgresql(dot)org
Subject: Re: pg_restore documentation
Date: 2017-06-28 18:46:18
Message-ID: 1037.1498675578@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

wkhatch(at)me(dot)com writes:
> Following docs, I'm having an unexpected failure when I issue this format of
> the command:
> pg_restore drupal_dump.sql -h
> adjh4syhpk555s.cckxxqjsrxhd.us-east-1.rds.amazonaws.com -U someUser -W
> yeahRight -d wm_drupal
> I get error:
> pg_restore: too many command-line arguments (first is "yeahRight")
> I would absolutely expect this to at least initiate, and not fail due to
> command syntax issues.

The -W option is clearly documented as not taking any parameter, so
I'm unclear on why you feel that this command doesn't have syntax issues.

> I feel this documentation is lacking, as there are no
> examples for using multiple arguments and options,

Did you read down to the "Examples" section?

> and it does not appear to
> work the way a typical shell utility would work

AFAIK, this behavior is extremely common, because it's using the standard
getopt_long() library function to parse the arguments.

The fact that you can write the dump file name first, rather than after
the switch options as documented, is because your platform supplies a
version of getopt_long() that will allow that. We don't document that
because it wouldn't work everywhere; the syntax depicted in the manual is
what we consider supported. We could force the issue by refusing to use
the platform's getopt_long(), but then we'd act less like other shell
utilities which do use it.

regards, tom lane

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message mudit0201 2017-06-29 12:23:30 Password encryption
Previous Message David G. Johnston 2017-06-28 18:39:00 Re: pg_restore documentation