David Johnston <polobo@yahoo.com> writes:
> I'm dubious this would be much of a realistic improvement in ease-of-use -
> at least in the Linux/bash world where you are much better off constructing
> some form of here-doc - and passing that in via standard input - if you need
> to make use of multiple statements and usually want white-space to make
> reading/maintaining those statements easier.
Yeah. The psql man page fails to suggest here-documents in this context,
which seems like rather an oversight. Perhaps what we should do is add
something like this to the description of -c:
Because of these legacy behaviors, passing more than one command to -c
often has unexpected results. It's better to feed multiple commands
to psql's standard input, either using "echo" as illustrated above,
or via a shell here-document, for example
psql <<EOF
\x
SELECT * FROM foo
EOF
regards, tom lane