BUG #9198: psql -c 'SET; ...' not working - Mailing list pgsql-bugs

From christoph.berg@credativ.de
Subject BUG #9198: psql -c 'SET; ...' not working
Date
Msg-id 20140212125626.2710.94912@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #9198: psql -c 'SET; ...' not working
Re: BUG #9198: psql -c 'SET; ...' not working
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      9198
Logged by:          Christoph Berg
Email address:      christoph.berg@credativ.de
PostgreSQL version: 9.3.2
Operating system:   Linux
Description:

This seems to be a bug:

# alter role cbe set statement_timeout = '1s';

psql -c "SHOW statement_timeout"
 statement_timeout
-------------------
 1s

psql -c "SET statement_timeout = '3s'; SHOW statement_timeout"
 statement_timeout
-------------------
 3s

time psql -c "SET statement_timeout = '3s'; SELECT pg_sleep(2)"
ERROR:  canceling statement due to statement timeout
real    0m1.065s

As witnessed by the time output, the timeout is the one from ALTER ROLE, not
the new one. Seen on 9.2 and 9.3.

The psql docs mention that -c is treated differently from stdin when
multiple commands are executed, but that shouldn't include SET not getting
into effect.

pgsql-bugs by date:

Previous
From: Tomonari Katsumata
Date:
Subject: Re: BUG #8470: 9.3 locking/subtransaction performance regression
Next
From: Christoph Berg
Date:
Subject: Re: BUG #9198: psql -c 'SET; ...' not working