[JDBC driver] DBConstraint violation within transaction block leaves connection in indeterminate state
От | Adrian Geissel |
---|---|
Тема | [JDBC driver] DBConstraint violation within transaction block leaves connection in indeterminate state |
Дата | |
Msg-id | 052a01c172a0$2c4c0d40$6a0078c1@zenark.ie обсуждение исходный текст |
Список | pgsql-bugs |
Hi, I'm running Postgresql 7.1.2 server on RedHat Linux 7.1 (intel) and connect= ing using JDBC on Windows NT using jdbc7.1-1.2.jar. The sequence to reproduce the error is as follows: 1. Create database with various constraints (such as UNIQUE, CHECK, etc). 2. Queue 3 or more INSERT / UPDATE statements on a connection with AutoComm= it turned off. 3. Let the second statement violate a structural constraint (as specified i= n 1. above) 4. Commit the transaction 5. Now issue any database query statement against the same connection. =3D=3DBUG: the query that is executed is the third queued statemenet, which= does not return any results To work-around this, trap the SQLException that is thrown within the transa= ction block and call connection.rollback(). My understanding in relation to transaction blocks is that if the transacti= on fails, then the database is not updated. Furthermore, I would also expec= t that the connection is left in an equally clean state, but this clearly i= s not the case. If the transaction fails, then surely all statements queued= should be considered expired, and let the caller re-queue them as part of = error recovery. Please clarify whether my expected behaviour is correct, and if this is a b= ug, then it needs to be addressed. Many thanks Adrian Geissel
В списке pgsql-bugs по дате отправления: