Quoting KB Sriram <[EMAIL PROTECTED]>:

> 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).


PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/

Reply via email to