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