From: | Mark Rotteveel <mark(at)lawinegevaar(dot)nl> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: JDBC String to Bool spec |
Date: | 2017-01-16 08:37:46 |
Message-ID: | a001bc6478afed33e0da45f04262efc5@lawinegevaar.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On 2017-01-16 00:20, Kevin Wooten 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.
As far as I know the JDBC spec defers to the SQL standard specification
for this. Unfortunately I don't have a copy handy to check how the SQL
standard defines it.
Mark
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Kellerer | 2017-01-16 08:59:24 | Re: JDBC String to Bool spec |
Previous Message | itoshun001@efeel.to | 2017-01-16 07:05:54 | old JDBC driver (8.1-JDBC3) can connect to postgresql 9.x ? |