Re: Statement-level rollback - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Statement-level rollback
Date
Msg-id 201901311651.7423v77436hk@alvherre.pgsql
Whole thread Raw
In response to Re: Statement-level rollback  (Greg Stark <stark@mit.edu>)
List pgsql-hackers
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-aab2ff2b05ef@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


pgsql-hackers by date:

Previous
From: Stas Kelvich
Date:
Subject: Re: Global snapshots
Next
From: Tom Lane
Date:
Subject: Re: Fast path for empty relids in check_outerjoin_delay()