pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #16230: Boolean column stick to "false" after calling updateRow() on updateable ResultSet
3+ messages / 3 participants
[nested] [flat]
* BUG #16230: Boolean column stick to "false" after calling updateRow() on updateable ResultSet
@ 2020-01-25 19:05 PG Bug reporting form <noreply@postgresql.org>
2020-01-26 06:56 ` Re: BUG #16230: Boolean column stick to "false" after calling updateRow() on updateable ResultSet David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: PG Bug reporting form @ 2020-01-25 19:05 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: linuxhippy@gmail.com
The following bug has been logged on the website:
Bug reference: 16230
Logged by: Clemens Eisserer
Email address: linuxhippy@gmail.com
PostgreSQL version: 12.1
Operating system: linux / platform independent
Description:
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:
int col = columnIndex - 1;
if (Oid.BOOL == fields[col].getOID()) {
final byte[] v = thisRow[col];
return (1 == v.length) && (116 == v[0]); // 116 = 't'
}
... 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.
Code to trigger the problem:
//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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #16230: Boolean column stick to "false" after calling updateRow() on updateable ResultSet
2020-01-25 19:05 BUG #16230: Boolean column stick to "false" after calling updateRow() on updateable ResultSet PG Bug reporting form <noreply@postgresql.org>
@ 2020-01-26 06:56 ` David G. Johnston <david.g.johnston@gmail.com>
2020-01-26 13:07 ` Re: BUG #16230: Boolean column stick to "false" after calling updateRow() on updateable ResultSet Clemens Eisserer <linuxhippy@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: David G. Johnston @ 2020-01-26 06:56 UTC (permalink / raw)
To: Clemens Eisserer <linuxhippy@gmail.com>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On Sat, Jan 25, 2020 at 12:06 PM PG Bug reporting form <
noreply@postgresql.org> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 16230
> Logged by: Clemens Eisserer
> Email address: linuxhippy@gmail.com
> PostgreSQL version: 12.1
> Operating system: linux / platform independent
> Description:
>
> 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 core PostgreSQL team doesn't maintain the pgJDBC driver. You need to
report this to them using their process.
https://jdbc.postgresql.org/
David J.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #16230: Boolean column stick to "false" after calling updateRow() on updateable ResultSet
2020-01-25 19:05 BUG #16230: Boolean column stick to "false" after calling updateRow() on updateable ResultSet PG Bug reporting form <noreply@postgresql.org>
2020-01-26 06:56 ` Re: BUG #16230: Boolean column stick to "false" after calling updateRow() on updateable ResultSet David G. Johnston <david.g.johnston@gmail.com>
@ 2020-01-26 13:07 ` Clemens Eisserer <linuxhippy@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Clemens Eisserer @ 2020-01-26 13:07 UTC (permalink / raw)
To: pgsql-jdbc@postgresql.org
Hi David,
> The core PostgreSQL team doesn't maintain the pgJDBC driver. You need to report this to them using their process.
Thanks for the note, I've filed the bug-report again at the pgJDBC
github project.
Best regards & thanks, Clemens
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2020-01-26 13:07 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-01-25 19:05 BUG #16230: Boolean column stick to "false" after calling updateRow() on updateable ResultSet PG Bug reporting form <noreply@postgresql.org>
2020-01-26 06:56 ` David G. Johnston <david.g.johnston@gmail.com>
2020-01-26 13:07 ` Clemens Eisserer <linuxhippy@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox