As the OP I’d like to make a clarification….
I didn’t want to use a string of “1.0” and convert it to a Boolean. The driver, in its test suite, tests for this specific case (and a few others). These seemed really out of the norm since the database doesn’t support this. Thus my investigation began.
Hello,
Since we now know the JDBC spec doesn’t support this (thanks to all
of Mark Rotteveel’s sleuthing) & we know Postgres doesn’t support
this. It seems the “feature" should be removed or placed behind an
option. Postgres results in an error here and considering this is
a driver tied to that database I look to that to clarify ambiguity.
These examples should all result in an error.
Yes, I agree, a "feature" that allows bad code should be considered
a "bug".
The OP in the original post used a string of "1.0" and wanted toconvert it into a boolean. If you use setBoolean in a preparedstatement it expects the argument to be a "numeric" type, so it is notsurprising that the string was converted to a double. You'd expectsomething along the lines of ps.setBoolean(5,"xyz") to throw an error.I don't know how many string values are to be considered "true" in theapplication. Maybe use some regular expressions to suss out "true"values?My two cents.Rob-- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-jdbc