pgjdbc/pgjdbc — pull request #233 by kingter (2014-12-05 03:21:20+00:00)
Title: Fix the test code of testUpdateWithPGobject, for cannot update ResultSet

The test testUpdateWithPGobject still failed due to other 2 issues below:

The ResultSet cannot be updated.
Fixed by initialize statement with flag "CONCUR_UPDATABLE".

[junit] Testcase: testUpdateWithPGobject(org.postgresql.test.jdbc2.ResultSetTest): Caused an ERROR
[junit] ResultSets with concurrency CONCUR_READ_ONLY cannot be updated.
[junit] org.postgresql.util.PSQLException: ResultSets with concurrency CONCUR_READ_ONLY cannot be updated.
[junit] at org.postgresql.jdbc2.AbstractJdbc2ResultSet.isUpdateable(AbstractJdbc2ResultSet.java:1583)
[junit] at org.postgresql.jdbc2.AbstractJdbc2ResultSet.checkUpdateable(AbstractJdbc2ResultSet.java:2840)
[junit] at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateValue(AbstractJdbc2ResultSet.java:3208)
[junit] at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateObject(AbstractJdbc2ResultSet.java:1244)
[junit] at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateObject(AbstractJdbc2ResultSet.java:1570)
[junit] at org.postgresql.test.jdbc2.ResultSetTest.testUpdateWithPGobject(ResultSetTest.java:743)
[junit]

After issue above was fixed, will encounter "No primary key" issue when trying to update the table.
Fixed by setting primary key for test table "testpgobject".

[junit] Testcase: testUpdateWithPGobject(org.postgresql.test.jdbc2.ResultSetTest): Caused an ERROR
[junit] No primary key found for table testpgobject.
[junit] org.postgresql.util.PSQLException: No primary key found for table testpgobject.
[junit] at org.postgresql.jdbc2.AbstractJdbc2ResultSet.isUpdateable(AbstractJdbc2ResultSet.java:1651)
[junit] at org.postgresql.jdbc2.AbstractJdbc2ResultSet.checkUpdateable(AbstractJdbc2ResultSet.java:2840)
[junit] at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateValue(AbstractJdbc2ResultSet.java:3208)
[junit] at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateObject(AbstractJdbc2ResultSet.java:1244)
[junit] at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateObject(AbstractJdbc2ResultSet.java:1570)
[junit] at org.postgresql.test.jdbc2.ResultSetTest.testUpdateWithPGobject(ResultSetTest.java:744)
[junit]

The Jdbc2TestSuite can finally full pass now.

runtest:
[mkdir] Created dir: /home/kingter/pgjdbc/build/testresults
[junit] Testsuite: org.postgresql.test.jdbc2.Jdbc2TestSuite
[junit] Tests run: 337, Failures: 0, Errors: 0, Time elapsed: 67.633 sec