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.

i.e., the following is valid:

psql [dbname] [option...] [# you can place username here but only if dbname
is specified...]

Ubuntu Bash; 9.5 tested.

I'm not sure how one would actually document the above in a syntax
specification without being overly verbose but there is no hint that I've
found pertaining to the true behavior.  Haven't played with any other of
the supplied binaries; I stumbled across this because I was wrapping psql
in specialized functions and was surprised that where I placed the "$@"
and/or the "service=service-name" specification didn't seem to matter.

Is this some general Bash/Linux-ism that I've just never read about or
realized until now?

David J.

Reply via email to