Re: JDBC String to Bool spec

From: Jorge Solórzano <jorsol(at)gmail(dot)com>
To: Kevin Wooten <kdubb(at)me(dot)com>
Cc: Dave Cramer <pg(at)fastcrypt(dot)com>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC String to Bool spec
Date: 2017-01-16 20:32:35
Message-ID: CA+cVU8MyUSd6qc2AuB1Eo6QFAC_U1OF_N96Vr6cSmXN9YQSjiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Mon, Jan 16, 2017 at 2:22 PM, Kevin Wooten <kdubb(at)me(dot)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".

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message rob stone 2017-01-16 21:16:02 Re: JDBC String to Bool spec
Previous Message Kevin Wooten 2017-01-16 20:28:52 Re: JDBC String to Bool spec