On 2019-Jan-31, Greg Stark wrote:

> This looks like repeating the autocommit mistakes of the past.

Yeah, this argument has been made before.  Peter E argued against that:
https://postgr.es/m/ea395aa8-5ac4-6bcd-366d-aab2ff2b0...@2ndquadrant.com

> And based on that experience wouldn't the replacement approach be to do
> this client side?

JDBC has a feature for this already (see "autosave" in [1]), but
apparently you get a good performance improvement by doing it
server-side, which is why this was written in the first place.  psql
also has ON_ERROR_ROLLBACK [2].

> If libpq had a library option to wrap every statement in a
> subtransaction by adding begin/end then this problem would be
> completely sidestepped.

I don't think anyone's talked about doing it in libpq before
specifically, and if you did that, it would obviously have to be
implemented separately on JDBC.

[1] 
https://jdbc.postgresql.org/documentation/head/connect.html#connection-parameters
[2] https://www.postgresql.org/docs/current/app-psql.html

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Reply via email to