Re: BUG #9198: psql -c 'SET; ...' not working

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christoph Berg <christoph(dot)berg(at)credativ(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #9198: psql -c 'SET; ...' not working
Date: 2014-02-13 16:45:00
Message-ID: 5270.1392309900@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Christoph Berg <christoph(dot)berg(at)credativ(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-02-13 16:53:18 Re: BUG #9198: psql -c 'SET; ...' not working
Previous Message Tom Lane 2014-02-13 16:40:29 Re: BUG #9202: C Functions crash database too easily