"David G. Johnston" <david.g.johnston@gmail.com> writes:
> I don't know if this applies anywhere else but I just stumbled across the
> fact that our psql documentation is imprecise:
> https://www.postgresql.org/docs/current/static/app-psql.html
> psql [option...] [dbname [username]]
> It does matter that "dbname" precede username; and that it be present if
> username is specified. But otherwise the first one or two non-option words
> on the command line are taken to be those regardless of position, and any
> extra non-option words are ignored. Options can thus be specified before,
> after, or in between the dbname and username.
This is, unfortunately, platform-specific. glibc's version of
getopt_long() takes it upon itself to physically rearrange the argv
list to make such cases work. On platforms where getopt_long() does
not so blatantly exceed its authority, only the documented argument
order will work.
regards, tom lane