Multiple semicolon separated statements and autocommit - Mailing list pgsql-hackers

From Rene Pijlman
Subject Multiple semicolon separated statements and autocommit
Date
Msg-id cbqqotcde1c6s8c58nk26ui4et27agdqrq@4ax.com
Whole thread Raw
Responses Re: Multiple semicolon separated statements and autocommit
List pgsql-hackers
We're discussing an implementation of JDBC's
Statement.executeBatch() on the pgsql-jdbc list. The idea is to
send multiple semicolon separated statements in one call to the
backend. The purpose of this feature is of course a performance
improvement, since it executes multiple (non-select) statements
with one round trip to the server.

If autocommit is _enabled_ and S1;S2;S3 is send to the database,
what exactly is the behaviour of the backend? For example, what
happens if S1 succeeds, S2 fails and S3 would succeed?

Does autocommit apply to the statement list send in one call as
a whole? Or does it apply to individual statements?

If autocommit applies to the list as a whole I assume the
failure of S2 would cause the entire statement list to fail and
be rolled back.

If autocommit applies to individual statements in the list, I
assume that S1 succeeds and is committed, S2 fails and is rolled
back. But is S3 still executed? And what update count is
returned to the client in that case?

I will summarize on pgsql-jdbc.

Regards,
René Pijlman <rene@lab.applinet.nl>


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: INTERVAL type: SQL92 implementation
Next
From: Francesco Casadei
Date:
Subject: Re: [SQL] getting the oid for a new tuple in a BEFORE trigger