On Mon, Jan 16, 2017 at 2:22 PM, Kevin Wooten <kdubb@me.com> wrote:
I agree it should support all the types the JDBC spec says it should; and it does. I’m focused on the CHAR/VARCHAR to Boolean conversion.
To add to your example
CREATE TABLE testboolstring (a varchar(30));
INSERT INTO testboolstring VALUES('this is not true’);
>> ResultSet.getBoolean(1) returns FALSE
INSERT INTO testboolstring VALUES(‘1.0’);
>> ResultSet.getBoolean(1) returns TRUE
INSERT INTO testboolstring VALUES(2.2’);
>> ResultSet.getBoolean(1) returns FALSE
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".