chained transactions

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: chained transactions
Date: 2018-03-01 03:35:52
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

This feature is meant to help manage transaction isolation in
procedures. I proposed elsewhere a patch that allows running SET
TRANSACTION in PL/pgSQL. But if you have complex procedures that commit
many times in different branches perhaps, you'd have to do this in every
new transaction, which would create code that is difficult to manage.

The SQL standard offers the "chained transactions" feature to address
this. The new command variants COMMIT AND CHAIN and ROLLBACK AND CHAIN
immediately start a new transaction with the characteristics (isolation
level, read/write, deferrable) of the previous one. So code that has
particular requirements regard transaction isolation and such can use
this to simplify code management.

In the patch series, 0001 through 0006 is some preparatory code cleanup
that is useful independently. 0007 is the implementation of the feature
for the main SQL environment, 0008 is for PL/pgSQL. Support in other
PLs could be added easily.

The patch series also requires the "SET TRANSACTION in PL/pgSQL" patch
for use in the test suite.

Peter Eisentraut
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v1-0001-Update-function-comments.patch text/plain 3.1 KB
v1-0002-Rename-TransactionChain-functions.patch text/plain 19.0 KB
v1-0003-Simplify-parse-representation-of-savepoint-comman.patch text/plain 7.7 KB
v1-0004-Improve-savepoint-error-messages.patch text/plain 2.9 KB
v1-0005-Change-transaction-state-debug-strings-to-match-e.patch text/plain 1.9 KB
v1-0006-Turn-transaction_isolation-into-GUC-enum.patch text/plain 5.4 KB
v1-0007-Transaction-chaining.patch text/plain 19.0 KB
v1-0008-Transaction-chaining-support-in-PL-pgSQL.patch text/plain 15.4 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2018-03-01 04:14:23 fixing more format truncation issues
Previous Message David Gould 2018-03-01 03:23:37 Re: [patch] BUG #15005: ANALYZE can make pg_class.reltuples inaccurate.