Christoph Berg <christoph.berg@credativ.de> writes:
> ... I'd propose something like this doc update:
> <application>psql</application>'s standard input. Also, only
> ! the result of the last SQL command is returned. <command>SET</>
> ! commands that modify statement behavior will be ineffective because
> ! they are part of the already running statement. Most notably,
> ! <literal>psql -c 'SET statement_timeout = 0; SELECT ...'</literal>
> ! will not work as expected. (Use <literal>echo '...' | psql</literal>
> ! as above instead.)
This is incorrect though; most variables you can set via SET actually
will work unsurprisingly in this context. statement_timeout is different
because its value is only inspected at the start of a statement (where
"statement" is defined as "query string received from the client").
regards, tom lane