Re: [JDBC] JDBC String to Bool spec - Mailing list pgsql-jdbc

From Jorge Solórzano
Subject Re: [JDBC] JDBC String to Bool spec
Date
Msg-id CA+cVU8MyUSd6qc2AuB1Eo6QFAC_U1OF_N96Vr6cSmXN9YQSjiw@mail.gmail.com
Whole thread Raw
In response to Re: [JDBC] JDBC String to Bool spec  (Kevin Wooten <kdubb@me.com>)
Responses Re: [JDBC] JDBC String to Bool spec
Re: JDBC String to Bool spec
List pgsql-jdbc

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".


pgsql-jdbc by date:

Previous
From: Kevin Wooten
Date:
Subject: Re: [JDBC] JDBC String to Bool spec
Next
From: rob stone
Date:
Subject: Re: JDBC String to Bool spec