pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Rotteveel <mark@lawinegevaar.nl>
To: pgsql-jdbc@postgresql.org
Subject: Re: JDBC String to Bool spec
Date: Mon, 16 Jan 2017 09:37:46 +0100
Message-ID: <a001bc6478afed33e0da45f04262efc5@lawinegevaar.nl> (raw)
In-Reply-To: <990BE54A-5803-4B5A-A5C8-BD6DBE75B72C@me.com>
References: <990BE54A-5803-4B5A-A5C8-BD6DBE75B72C@me.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (26+ messages)  latest in thread

Message-ID: <a001bc6478afed33e0da45f04262efc5@lawinegevaar.nl>
Permalink:  ../a001bc6478afed33e0da45f04262efc5@lawinegevaar.nl/
Also on:    postgresql.org/message-id/a001bc6478afed33e0da45f04262efc5@lawinegevaar.nl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: mark@lawinegevaar.nl
  Subject: Re: JDBC String to Bool spec
  In-Reply-To: <a001bc6478afed33e0da45f04262efc5@lawinegevaar.nl>
  References: <990BE54A-5803-4B5A-A5C8-BD6DBE75B72C@me.com> <a001bc6478afed33e0da45f04262efc5@lawinegevaar.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox