New parameter RollbackError to control rollback behavior on error - Mailing list pgsql-hackers

From Michael Paquier
Subject New parameter RollbackError to control rollback behavior on error
Date
Msg-id CAB7nPqRrnMgMMW2maGOA3sOXtA12=Pogt4dpDzQR2fb8zffcmQ@mail.gmail.com
Whole thread Raw
Responses Re: New parameter RollbackError to control rollback behavior on error  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Re: New parameter RollbackError to control rollback behavior on error  (Michael Paquier <michael.paquier@gmail.com>)
Re: New parameter RollbackError to control rollback behavior on error  (Hiroshi Inoue <inoue@tpf.co.jp>)
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: issue log message to suggest VACUUM FULL if a table is nearly empty
Next
From: Peter Geoghegan
Date:
Subject: "Conditional jump or move depends on uninitialised value(s)" within tsginidx.c