Re: Suggestion - Mailing list pgsql-advocacy

From Richard Huxton
Subject Re: Suggestion
Date
Msg-id 200403112030.53891.dev@archonet.com
Whole thread Raw
In response to Re: Suggestion  (Gandalf <gandalf@geochemsource.com>)
List pgsql-advocacy
On Thursday 11 March 2004 19:49, Gandalf wrote:
> > It is because the transaction has failed and thus rolledback. We do
> > not support nested transactions.
>
> Sorry, this was not my question, I was not clear though. By the way, I'm
> looking forward for nested transactions. I read about
> WAL and I know that at some point we will have nested transactions in
> PostgreSQL.
>
> Consider this (where cmd2 is an atomic UPDATE but the others can be
> complex):
>
> try:
>   cmd1;
>   try:
>      cmd2;
>      failed = false;
>   except:
>      failed = true;
>    end
>    if failed  then
>       cmd3;

This sort of thing will be implemented via nested transactions. Large areas of
the PG code (so I have been told) assume that if they encounter a problem,
they can just raise an error, stop and let the end-of-transaction code clean
up behind them.

It is the developers' opinion that nested transactions are the
simplest/cleanest way of dealing with this. They also give you other benefits
of course.

If you are interested in the details, check the list archives - you're not the
first to ask the question. Probably the general and hackers lists are the
ones to look at.

PS - this question is probably for -general rather than -advocacy, not that
it's a big problem or anything.

HTH
--
  Richard Huxton
  Archonet Ltd

pgsql-advocacy by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Comparison of PGSQL and DB2
Next
From: Jonathan Gardner
Date:
Subject: Re: Comparison of PGSQL and DB2