Re: Xn block abort exceptions: BUG+PATCH - Mailing list pgsql-jdbc

From Peter T Mount
Subject Re: Xn block abort exceptions: BUG+PATCH
Date
Msg-id 981978349.3a87cceda8220@webmail.retep.org.uk
Whole thread Raw
In response to Xn block abort exceptions: BUG+PATCH  (KB Sriram <kbs@snapfish.com>)
List pgsql-jdbc
Quoting KB Sriram <kbs@snapfish.com>:

> I'm using the 7.0.3 release JDBC driver, and observed that when
> Postgres aborts the transaction because of a problem within a
> transaction block, SQLExceptions are not always thrown from the
> driver on further queries within that block.
>
> For example: say I have a table
> create table x (pk int4 primary key);
>
> I then start a transaction block and insert two duplicate keys
> con.setAutoCommit(false);
> Statement s = con.createStatement();
> s.executeUpdate("insert into x values (1)"); // works fine
> try {
>   s.executeUpdate("insert into x values (1)"); // raises a duplicate
> key
> SQLException
> } catch (SQLException sqle) { sqle.printStackTrace(); }
> s.executeUpdate("insert into x values(2)"); // no exception thrown
>
> Looking into the code, it looked as though the *ABORT STATUS* message
> in the protocol was being ignored in the driver. I've attached a patch
> (against the 7.0.3 driver) of the changes that made it work better
> for me.

I'm away from the source at the moment, but I'll check this one out. I'm not
sure but there may have been a fix for this already (can't be certain).

Peter

--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/

pgsql-jdbc by date:

Previous
From: Michael Ansley
Date:
Subject: DB Arrays in the JDBC driver
Next
From: Peter T Mount
Date:
Subject: Status of JDBC web site