Re: Suggestion

From: Richard Huxton <dev(at)archonet(dot)com>
To: Gandalf <gandalf(at)geochemsource(dot)com>, pgsql-advocacy(at)postgresql(dot)org
Subject: Re: Suggestion
Date: 2004-03-11 20:30:53
Message-ID: 200403112030.53891.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-advocacy by date

  From Date Subject
Next Message Marc G. Fournier 2004-03-11 20:40:32 Re: The big MySQL spin
Previous Message Jonathan Gardner 2004-03-11 20:30:38 Re: Comparison of PGSQL and DB2