From: Gianni Ciolli <gianni.ciolli@2ndquadrant.it>
To: Marti Raudsepp <marti@juffo.org>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Autonomous subtransactions
Date: Mon, 19 Dec 2011 20:43:09 +0000
Message-ID: <20111219204309.GC26381@leggeri.gi.lan> (raw)
In-Reply-To: <CABRT9RC4kzL+qBwbNCBFtWPUyzMZHQ=xjs0pE2pcPoG7Xsx4RA@mail.gmail.com>
References: <20111218082812.GA14355@leggeri.gi.lan>
<CABRT9RDMv5aKaF=jQx+T5=EQcqQpPkwLzjo4+2nb9=ryYHes+A@mail.gmail.com>
<CA+U5nML_TybggzCj+pTFk908WGR1_Ee+a-=edLTV7bZiaLpRdg@mail.gmail.com>
<CABRT9RC4kzL+qBwbNCBFtWPUyzMZHQ=xjs0pE2pcPoG7Xsx4RA@mail.gmail.com>
On Mon, Dec 19, 2011 at 09:32:06PM +0200, Marti Raudsepp wrote:
> Maybe that's just my paranoia, but the fact that subtransactions
> aren't named means it's pretty easy to accidentally get "out of step"
> and commit the wrong subtransaction. I see app developers often
> messing up BEGIN/COMMIT/ROLLBACK already. This is why I like the
> SAVEPOINT style; it's obvious when there's a bug.
For each COMMIT/ROLLBACK there is only one possible BEGIN
SUBTRANSACTION, therefore naming is not strictly necessary, unlike in
the SAVEPOINT case where you can have more than one option.
However, ISTM that allowing to optionally name each transaction could
provide a nice safety measure that the careful developer can use to
reduce the chances of human error. If subtransactions are not named,
no check is made; but if they are named, then the Xs on BEGIN
SUBTRANSACTION X and COMMIT/ROLLBACK SUBTRANSACTION X must match,
otherwise an exception is raised (and a bug is detected).
Regards,
Dr. Gianni Ciolli - 2ndQuadrant Italia
PostgreSQL Training, Services and Support
gianni.ciolli@2ndquadrant.it | www.2ndquadrant.it
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: gianni.ciolli@2ndquadrant.it, marti@juffo.org, simon@2ndquadrant.com
Subject: Re: Autonomous subtransactions
In-Reply-To: <20111219204309.GC26381@leggeri.gi.lan>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox