Re: Autonomous subtransactions

Поиск
Список
Период
Сортировка
От Gianni Ciolli
Тема Re: Autonomous subtransactions
Дата
Msg-id 20111219204309.GC26381@leggeri.gi.lan
обсуждение исходный текст
Ответ на Re: Autonomous subtransactions  (Marti Raudsepp <marti@juffo.org>)
Список pgsql-hackers
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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Gianni Ciolli
Дата:
Сообщение: Re: Autonomous subtransactions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Postgres 9.1: Adding rows to table causing too much latency in other queries