From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | David Johnston <polobo(at)yahoo(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #9198: psql -c 'SET; ...' not working |
Date: | 2014-02-13 16:53:18 |
Message-ID: | 5466.1392310398@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
David Johnston <polobo(at)yahoo(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-02-13 17:44:52 | Re: BUG #9204: truncate_identifier may be called unnecessarily on escaped quoted identifiers |
Previous Message | Tom Lane | 2014-02-13 16:45:00 | Re: BUG #9198: psql -c 'SET; ...' not working |