Stephen Frost <sfrost@snowman.net> writes:
> * Tom Lane (tgl@sss.pgh.pa.us) wrote:
>> I cannot duplicate the behavior you show, in either HEAD or 8.2.
> Wow. Okay, this is more interesting. It has some interaction with:
> \set ON_ERROR_ROLLBACK 'on'
> in my .psqlrc. If I remove that, then it works as expected.
Ah. log_statement = all tells the tale:
regression=# set log_statement='all';
SET
regression=# \set ON_ERROR_ROLLBACK 'on'
regression=# begin;
BEGIN
regression=# set local role tgl;
SET
regression=# show role;
role
------
none
(1 row)
regression=#
and the postmaster log has
2007-06-28 22:02:14.418 EDT 2870 LOG: statement: begin;
2007-06-28 22:02:26.044 EDT 2870 LOG: statement: SAVEPOINT pg_psql_temporary_savepoint
2007-06-28 22:02:26.045 EDT 2870 LOG: statement: set local role tgl;
2007-06-28 22:02:26.047 EDT 2870 LOG: statement: RELEASE pg_psql_temporary_savepoint
2007-06-28 22:02:57.545 EDT 2870 LOG: statement: SAVEPOINT pg_psql_temporary_savepoint
2007-06-28 22:02:57.546 EDT 2870 LOG: statement: show role;
2007-06-28 22:02:57.548 EDT 2870 LOG: statement: RELEASE pg_psql_temporary_savepoint
So actually, ON_ERROR_ROLLBACK breaks *any* use of SET LOCAL, not just
ROLE. Not sure that this is fixable :-(
regards, tom lane