pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: rob stone <floriparob@gmail.com>
To: Jorge Solórzano <jorsol@gmail.com>
To: Kevin Wooten <kdubb@me.com>
Cc: Dave Cramer <pg@fastcrypt.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: JDBC String to Bool spec
Date: Tue, 17 Jan 2017 08:16:02 +1100
Message-ID: <1484601362.6580.1.camel@gmail.com> (raw)
In-Reply-To: <CA+cVU8MyUSd6qc2AuB1Eo6QFAC_U1OF_N96Vr6cSmXN9YQSjiw@mail.gmail.com>
References: <990BE54A-5803-4B5A-A5C8-BD6DBE75B72C@me.com>
	<CADK3HHJQiDaExrbJf1n9vQmkq67XibcdBw6TWMDsBV0rKoV9Bw@mail.gmail.com>
	<67BD0617-E3A5-43BD-9770-6C2611187092@me.com>
	<83AB5852-8884-465E-80D8-A49B6CB05A88@me.com>
	<CADK3HHJg0mVo5AaD-oYUNCSb97GZPXn26hP-0wgtcgy_gTNkTQ@mail.gmail.com>
	<0AA59CB8-5010-4E1A-A631-DF7819F40EE5@me.com>
	<CA+cVU8OwF16Y=vGetySafj8B0Sa4pr_1DUCMW22P_GR6AtGW6A@mail.gmail.com>
	<CA+cVU8OTCz2Tx3SDmAvKfur=PbKK9WoQjm67vZU_ae-QGknQVQ@mail.gmail.com>
	<C52099C7-267A-4588-94F7-A9C913673F67@me.com>
	<CA+cVU8MFAfRad8Bba-049nk_9KKd-14FnW7An78W3S=_EZ5sww@mail.gmail.com>
	<BE77A43D-4E0A-44DE-9495-4E3D54C92DE3@me.com>
	<CA+cVU8MyUSd6qc2AuB1Eo6QFAC_U1OF_N96Vr6cSmXN9YQSjiw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (26+ messages)  latest in thread

Message-ID: <1484601362.6580.1.camel@gmail.com>
Permalink:  ../1484601362.6580.1.camel@gmail.com/
Also on:    postgresql.org/message-id/1484601362.6580.1.camel@gmail.com

 · 

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: floriparob@gmail.com, jorsol@gmail.com, kdubb@me.com, pg@fastcrypt.com
  Subject: Re: JDBC String to Bool spec
  In-Reply-To: <1484601362.6580.1.camel@gmail.com>
  References: <990BE54A-5803-4B5A-A5C8-BD6DBE75B72C@me.com> <CADK3HHJQiDaExrbJf1n9vQmkq67XibcdBw6TWMDsBV0rKoV9Bw@mail.gmail.com> <67BD0617-E3A5-43BD-9770-6C2611187092@me.com> <83AB5852-8884-465E-80D8-A49B6CB05A88@me.com> <CADK3HHJg0mVo5AaD-oYUNCSb97GZPXn26hP-0wgtcgy_gTNkTQ@mail.gmail.com> <0AA59CB8-5010-4E1A-A631-DF7819F40EE5@me.com> <CA+cVU8OwF16Y=vGetySafj8B0Sa4pr_1DUCMW22P_GR6AtGW6A@mail.gmail.com> <CA+cVU8OTCz2Tx3SDmAvKfur=PbKK9WoQjm67vZU_ae-QGknQVQ@mail.gmail.com> <C52099C7-267A-4588-94F7-A9C913673F67@me.com> <CA+cVU8MFAfRad8Bba-049nk_9KKd-14FnW7An78W3S=_EZ5sww@mail.gmail.com> <BE77A43D-4E0A-44DE-9495-4E3D54C92DE3@me.com> <CA+cVU8MyUSd6qc2AuB1Eo6QFAC_U1OF_N96Vr6cSmXN9YQSjiw@mail.gmail.com> <1484601362.6580.1.camel@gmail.com>

* 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