Обсуждение: [DOCS] pg_restore documentation
The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/9.2/static/app-pgrestore.html Description: 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. I feel this documentation is lacking, as there are no examples for using multiple arguments and options, and it does not appear to work the way a typical shell utility would work
On Monday, June 26, 2017, <wkhatch@me.com> wrote:
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")
All -W does is force a prompt. There is no way to actually supply the password on the command line, that is what environment variables or pgpass are for.
David J.
wkhatch@me.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