Multiple semicolon separated statements and autocommit

From: Rene Pijlman <rene(at)lab(dot)applinet(dot)nl>
To: pgsql-hackers(at)postgresql(dot)org
Cc: barry(at)xythos(dot)com
Subject: Multiple semicolon separated statements and autocommit
Date: 2001-08-29 22:20:07
Message-ID: cbqqotcde1c6s8c58nk26ui4et27agdqrq@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)lab(dot)applinet(dot)nl>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jon Lapham 2001-08-30 03:11:11 Odd rule behavior?
Previous Message Peter Eisentraut 2001-08-29 21:09:46 Re: NetBSD 1.5.1(HP300)