Re: autonomous transactions - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: autonomous transactions
Date
Msg-id 47c0f7f4-661d-11c4-0855-7d724c27930e@2ndquadrant.com
Whole thread Raw
In response to Re: autonomous transactions  (Greg Stark <stark@mit.edu>)
List pgsql-hackers
On 8/31/16 8:46 AM, Greg Stark wrote:
> I'm surprised by the background worker. I had envisioned autonomous
> transactions being implemented by allowing a process to reserve a
> second entry in PGPROC with the same pid. Or perhaps save its existing
> information in a separate pgproc slot (or stack of slots) and
> restoring it after the autonomous transaction commits.

There is quite likely room for a feature like that too, but it's not
this one.

> Using a background worker mean that the autonomous transaction can't
> access any state from the process memory.

That is intentional.

Autonomous transactions is actually a misnomer.  It's autonomous
sessions.  But Oracle names it wrong.  Autonomous sessions (or whatever
you want to call them) have their own session state, configuration
parameters, potentially different plugins loaded, different
authorization state, and so on.

> What happens if a
> statement timeout occurs during an autonomous transaction?

Right now not much. ;-)  But I think the behavior should be that the
autonomous session is aborted.

> What
> happens if you use a pl language in the autonomous transaction and if
> it tries to use non-transactional information such as prepared
> statements?

The same thing that happens if you open a new unrelated database
connection and try to do that.

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



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: WIP: About CMake v2
Next
From: Peter Eisentraut
Date:
Subject: Re: autonomous transactions