-
Notifications
You must be signed in to change notification settings - Fork 819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Boolean column stick to "false" after calling updateRow() on updateable ResultSet #1680
Comments
Thanks for the report |
davecramer
added a commit
to davecramer/pgjdbc
that referenced
this issue
Jan 28, 2020
…ling to set it to t or f instead of true or false
fixed in #1682 |
paplorinc
pushed a commit
to paplorinc/pgjdbc
that referenced
this issue
Feb 10, 2020
* origin/master: (427 commits) refactor: make PSQLState enum consts for integrity constraint violations (pgjdbc#1699) [maven-release-plugin] prepare for next development iteration [maven-release-plugin] prepare release REL42.2.10 pass gpg key through arguments add passphrase to release mvn task chore: update signing key Metadata queries improvment (pgjdbc#1694) WIP release notes for 42.2.10 (pgjdbc#1688) chore(deps): bump checkstyle from 8.28 to 8.29 in /pgjdbc (pgjdbc#1691) Cleanup PGProperty, sort values, and add some missing to docs (pgjdbc#1686) fix: Fixes issue pgjdbc#1592 where one thread is reading the copy and another thread closes the connection (pgjdbc#1594) Fixing LocalTime rounding (losing precision) (pgjdbc#1570) sync error message value with tested value (pgjdbc#1664) add DatabaseMetaDataCacheTest to test suite to run it (pgjdbc#1685) Fix Network Performance of PgDatabaseMetaData.getTypeInfo() method (pgjdbc#1668) fix: Issue pgjdbc#1680 updating a boolean field requires special handling to set it to t or f instead of true or false (pgjdbc#1682) fix testSetNetworkTimeoutEnforcement test failure (pgjdbc#1681) minor: fix checkstyle violation of unused import (pgjdbc#1683) fix: pgjdbc#1677 NumberFormatException when fetching PGInterval with small value (pgjdbc#1678) fix: actually use milliseconds instead of microseconds for timeouts (pgjdbc#1653) ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm submitting a ...
Describe the issue
Boolean columns always seem to stick to "false" after updateRow() is called
on updateable ResultSets (this is a regression and worked with
PostgreSQL-8.4.21 & postgresql-8.4-701.jdbc3.jar ).
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.
In PgResultSet.getBoolean() there is manual type conversion from byte[] to
boolean going on:
... so in case the value of thisRow[col] is a single character with the
letter 't' the check succeeds.
This is the case when the value was sent from the server (right after the
select or after calling refreshRow()).
However after updateRow(), fields[col]. contains the string "true", because
of length != 1, the check fails.
Driver Version?
42.2.9
Java Version?
8 and 11
OS Version?
Linux
PostgreSQL Version?
12.1
To Reproduce
//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.
Expected behaviour
true should be returned, instead of false
The text was updated successfully, but these errors were encountered: