Re: Xn block abort exceptions: BUG+PATCH
От | Peter T Mount |
---|---|
Тема | Re: Xn block abort exceptions: BUG+PATCH |
Дата | |
Msg-id | 981978349.3a87cceda8220@webmail.retep.org.uk обсуждение исходный текст |
Ответ на | Xn block abort exceptions: BUG+PATCH (KB Sriram <kbs@snapfish.com>) |
Список | 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 по дате отправления: