Boolean column stick to "false" after calling updateRow() onupdateable ResultSet
От | Clemens Eisserer |
---|---|
Тема | Boolean column stick to "false" after calling updateRow() onupdateable ResultSet |
Дата | |
Msg-id | CAFvQSYSMoYYJprnJhd2NjaDTE5wSxpY5N6xtVveBGGqZ35RpMQ@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Boolean column stick to "false" after calling updateRow() onupdateable ResultSet
|
Список | pgsql-jdbc |
Hi, I've observed something unexpected when migrating an application from PostgreSQL-8.4.21 & postgresql-8.4-701.jdbc3.jar to PostgreSQL-12 & postgresql-42.2.9. With the updated software-stack boolean columns always seem to stick to "false" after updateRow() is called on updateable ResultSets. The value stored however is correct, and calling refreshRow() right after updateRow() seems to restore the "old" behaviour and restores the value set a few lines aboce. I could fix the issue simply by forcing the additional roundtrip caused by refreshRow - however I still wonder - is the observed behaviour conformat to the spec / to be spected? Thank you in advance & best regards, Clemens //DDL CREATE TABLE sometable (id integer NOT NULL, someprop boolean DEFAULT false); //JDBC access Statement st = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = st.executeQuery("SELECT * FROM sometable WHERE id=..."); rs.next(); System.out.println(rs.getBoolean("someprop")); // value stored in DB rs.updateBoolean("vereinsFlugzeug", true); System.out.println(rs.getBoolean("someprop")); //Matches the value set above (true) rs.updateRow(); // rs.refreshRow(); //fetches the value stored System.out.println(rs.getBoolean("someprop")); // always returns false.
В списке pgsql-jdbc по дате отправления: