Re: autonomous transactions - Mailing list pgsql-hackers

From Gokulakannan Somasundaram
Subject Re: autonomous transactions
Date
Msg-id 9362e74e0801231247o16dca7e7xdf317c5b02876ed1@mail.gmail.com
Whole thread Raw
In response to Re: autonomous transactions  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: autonomous transactions  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers


I think the hard part would be error handling. You have to be able to catch
any errors and resume the outer transaction.
 
I think this is not right. Autonomous transactions are used as soon as you catch a error in order to log them. It can be used even for auditing. But resuming the outer transaction etc should not be on the plate of autonomous transactions. I am making an example here ...

Suppose you want to write a code which captures the attempt to change the sensitive information, and also fails the change made to sensitive information. In order to fail the change, we might need to rollback the transaction, which would prevent the attempt being logged. So if we have autonomous audit transaction, it will commit irrespective of the rollback which happened to the original transaction

The Audit transaction, which is a autonomous transaction need not catch any error and resume the outer transaction.

Thanks,
Gokul.

pgsql-hackers by date:

Previous
From: "Guillaume Smet"
Date:
Subject: Re: Thick indexes - a look at count(1) query
Next
From: Alvaro Herrera
Date:
Subject: Re: autonomous transactions