Re: Autonomous transaction - Mailing list pgsql-general

From Greg Stark
Subject Re: Autonomous transaction
Date
Msg-id 87isaixfxu.fsf@stark.xeocode.com
Whole thread Raw
In response to Autonomous transaction  (Daniel Daoust <daoustd_ca@yahoo.ca>)
List pgsql-general
Daniel Daoust <daoustd_ca@yahoo.ca> writes:

> Hi, knowing that "autonomous transaction" (Oracle
> concept of) are not yet implemented in PostgreSQL, has
> anyone found a work-around. I need to preserve
> database states from a potential rollback and then log
> them inside database tables.

Postgres goes to great lengths to ensure this is impossible :)

> What about:
>
> 1) using memory structures to hold the info, then
> commit to the database just before exit (after the
> rollback occurred).

Well this option in your application layer is how I would do it as it's the
simplest. However:

> 3) send messages to a daemon/database job that will
> write to the tables using another
> connection/transaction ???

This option is doable entirely in the database if that's your goal. You can do
this using dblink which is the contrib directory.

It would probably be quite simple to implement, though the most complex in
another sense. With twice as many connections it could be hard to determine
where slowdowns are starting for example. And Better make sure your error
logging connections don't trigger any errors...

--
greg

pgsql-general by date:

Previous
From: David Wheeler
Date:
Subject: ANNOUNCE: Bricolage 1.8.2 Released
Next
From: Phil Endecott
Date:
Subject: Re: Index inheritance