Re: timeout implementation issues - Mailing list pgsql-hackers

From Tom Lane
Subject Re: timeout implementation issues
Date
Msg-id 20396.1018274897@sss.pgh.pa.us
Whole thread Raw
In response to Re: timeout implementation issues  (Karel Zak <zakkr@zf.jcu.cz>)
Responses Re: timeout implementation issues  (Jan Wieck <janwieck@yahoo.com>)
Re: timeout implementation issues  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Karel Zak <zakkr@zf.jcu.cz> writes:
>  Is there some problem implement "SET ... ON ROLLBACK UNSET" ?

Yes.  See my previous example concerning search_path: that variable
MUST be rolled back at transaction abort, else we risk its value being
invalid.  We cannot offer the user a choice.

So far I have not seen one single example against SET rollback that
I thought was at all compelling.  In all cases you can simply issue
the SET in a separate transaction if you want to be sure that its
effects persist.  And there seems to be no consideration of the
possibility that applications might find SET rollback to be useful.
ISTM that the example with JDBC and query_timeout generalizes to other
parameters that you might want to set on a per-statement basis, such
as enable_seqscan or transform_null_equals.  Consider
BEGIN;SET enable_seqscan = false;some-queries-that-might-fail;SET enable_seqscan = true;END;

This does not work as intended if the initial SET doesn't roll back
upon transaction failure.  Yeah, you can restructure it to
SET enable_seqscan = false;BEGIN;some-queries-that-might-fail;END;SET enable_seqscan = true;

but what was that argument about some apps/drivers finding it
inconvenient to issue commands outside a transaction block?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: timeout implementation issues
Next
From: Jan Wieck
Date:
Subject: Re: timeout implementation issues