Re: JDBC String to Bool spec

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: Kevin Wooten <kdubb(at)me(dot)com>, rob stone <floriparob(at)gmail(dot)com>, Jorge Solórzano <jorsol(at)gmail(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 21:40:20
Message-ID: CAKFQuwZXSZ4ndCUp+6WybLca6jog56R1v=Lu3Jqp4JD+L3Jq6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

+1

On Mon, Jan 16, 2017 at 2:39 PM, Dave Cramer <pg(at)fastcrypt(dot)com> wrote:

> Seems to me we can introduce a breaking change in version 42. If this
> becomes an issue then we can put it back behind an option as Kevin
> suggested.
>
> Dave Cramer
>
> davec(at)postgresintl(dot)com
> www.postgresintl.com
>
> On 16 January 2017 at 16:20, Kevin Wooten <kdubb(at)me(dot)com> wrote:
>
>> 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.
>>
>> On Jan 16, 2017, at 2:16 PM, rob stone <floriparob(at)gmail(dot)com> wrote:
>>
>> 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 to
>> convert it into a boolean. If you use setBoolean in a prepared
>> statement it expects the argument to be a "numeric" type, so it is not
>> surprising that the string was converted to a double. You'd expect
>> something 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 the
>> application. Maybe use some regular expressions to suss out "true"
>> values?
>>
>> My two cents.
>>
>> Rob
>>
>>
>> --
>> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-jdbc
>>
>>
>>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message itoshun001@efeel.to 2017-01-16 22:41:58 Re: old JDBC driver (8.1-JDBC3) can connect to postgresql 9.x ?
Previous Message Dave Cramer 2017-01-16 21:39:04 Re: JDBC String to Bool spec