Re: autonomous transactions

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Joel Jacobson <joel(at)trustly(dot)com>
Cc: Jaime Casanova <jaime(dot)casanova(at)2ndquadrant(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: autonomous transactions
Date: 2016-08-31 16:22:23
Message-ID: CANP8+jJU3ynRLPoN-p1VTABdXKd3PVWRcQ7TCC4x6axSkWvpCw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 31 August 2016 at 14:09, Joel Jacobson <joel(at)trustly(dot)com> wrote:
> On Wed, Aug 31, 2016 at 6:41 AM, Jaime Casanova
> <jaime(dot)casanova(at)2ndquadrant(dot)com> wrote:
>>
>> On 30 August 2016 at 23:10, Joel Jacobson <joel(at)trustly(dot)com> wrote:
>> >
>> > There should be a way to within the session and/or txn permanently
>> > block autonomous transactions.
>> >
>>
>> This will defeat one of the use cases of autonomous transactions: auditing
>
> My idea on how to deal with this would be to mark the function to be
> "AUTONOMOUS" similar to how a function is marked to be "PARALLEL
> SAFE",
> and to throw an error if a caller that has blocked autonomous
> transactions tries to call a function that is marked to be autonomous.
>
> That way none of the code that needs to be audited would ever get executed.

Not sure I see why you would want to turn off execution for only some functions.

What happens if your function calls some other function with
side-effects? How would you roll that back? How would you mark
functions for the general case?

Functions with side effects can't be tested with simple unit tests;
that has nothing to do with autonomous transactions.

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2016-08-31 16:24:35 Re: proposal: psql \setfileref
Previous Message Simon Riggs 2016-08-31 16:15:59 Proposal for changes to recovery.conf API