New parameter RollbackError to control rollback behavior on error

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: New parameter RollbackError to control rollback behavior on error
Date: 2014-03-26 06:39:47
Message-ID: CAB7nPqRrnMgMMW2maGOA3sOXtA12=Pogt4dpDzQR2fb8zffcmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-odbc

Hi all,

The behavior of rollback when an error occurs on an handle is
controlled by extending Protocol with "$PROTNUM-[0|1|2]" where:
- 0 = let the application handle rollbacks
- 1 = rollback whole transaction when an error occurs
- 2 = rollback only statement that failed
Using such an extension is somewhat awkward as a single string is used
for two settings... The proposed attached patch adds a new parameter
called RollbackError that allows to control the behavior of rollback
on error with a different parameter.

For backward-compatibility purposes, this patch does not break the old
grammar of Protocol: it just gives the priority to RollbackError if
both Protocol and RollbackError are set for a connection. Regression
tests to test RollbackError and combinations of RollbackError/Protocol
are added in the patch in the existing test error-rollback (which has
needed some refactoring, older tests are not impacted). Docs are
included as well.

I thought first about including that in my cleanup work for 9.4, but
as this actually does not break the driver it may be worth adding it
directly to master, explaining the patch attached here. Comments
welcome. Note that if there are objections I do not mind adding that
for the work that would be merged later to 9.4 builds.

Regards,
--
Michael

Attachment Content-Type Size
20140326_error_rollback.patch text/plain 18.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2014-03-26 07:21:04 "Conditional jump or move depends on uninitialised value(s)" within tsginidx.c
Previous Message Robert Haas 2014-03-26 06:02:41 Re: issue log message to suggest VACUUM FULL if a table is nearly empty

Browse pgsql-odbc by date

  From Date Subject
Next Message Heikki Linnakangas 2014-03-26 08:53:52 Re: New parameter RollbackError to control rollback behavior on error
Previous Message Michael Paquier 2014-03-26 02:24:38 Re: Regression tests for error rollback protocol