Re: JDBC String to Bool spec

From: Kevin Wooten <kdubb(at)me(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC String to Bool spec
Date: 2017-01-15 23:33:46
Message-ID: 83AB5852-8884-465E-80D8-A49B6CB05A88@me.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Actually this table isn’t what I’m looking for. Related to example I provided below, there doesn’t seem to be a list of “acceptable values” when converting a string to a boolean; only that “getBoolean” must support conversion from VARCHAR/CHAR.

> On Jan 15, 2017, at 4:29 PM, Kevin Wooten <kdubb(at)me(dot)com> wrote:
>
> Thanks… is there a reason those tables were dropped from the 4.2 spec PDF?
>
>> On Jan 15, 2017, at 4:26 PM, Dave Cramer <pg(at)fastcrypt(dot)com <mailto:pg(at)fastcrypt(dot)com>> wrote:
>>
>> http://download.oracle.com/otn-pub/jcp/jdbc-4_1-mrel-spec/jdbc4.1-fr-spec.pdf?AuthParam=1484522754_78e98a772cf0c1f6c7f18ab76e324ff5 <http://download.oracle.com/otn-pub/jcp/jdbc-4_1-mrel-spec/jdbc4.1-fr-spec.pdf?AuthParam=1484522754_78e98a772cf0c1f6c7f18ab76e324ff5>
>>
>> Has a table on page 211 if that is what you are looking for
>>
>> Dave Cramer
>>
>> davec(at)postgresintl(dot)com <mailto:davec(at)postgresintl(dot)com>
>> www.postgresintl.com <http://www.postgresintl.com/>
>> On 15 January 2017 at 18:20, Kevin Wooten <kdubb(at)me(dot)com <mailto:kdubb(at)me(dot)com>> wrote:
>> Does anybody know where in the specification it details the required/acceptable conversions from string values to boolean? I cannot seem to find it in the PDF for 4.2.
>>
>> I am curious about some of the conversions that are done. For example, calling “ResultSet.getBoolean” on a text/varchar column with the value “1.0”. This conversion succeeds because the driver (both pgjdbc & ng) fallback to decoding the column as a double then converting that by testing it “== 1”; which seems valid but questionable since “!= 0” would also be valid, but vastly different.
>>
>> This is not allowed by Postgres (e.g. “SELECT “1.0”::bool;” results in an error) and I cannot find anything in JDBC as of yet.
>>
>> --
>> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org <mailto:pgsql-jdbc(at)postgresql(dot)org>)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-jdbc <http://www.postgresql.org/mailpref/pgsql-jdbc>
>>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2017-01-15 23:42:11 Re: JDBC String to Bool spec
Previous Message Kevin Wooten 2017-01-15 23:29:40 Re: JDBC String to Bool spec