pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Craig Ringer <craig@2ndquadrant.com>
Cc: Tom Dunstan <pgsql@tomd.cc>
Cc: Hudson, Derrick <dhudson@redcom.com>
Cc: Marc G. Fournier <scrappy@hub.org>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] JPA + enum == Exception
Date: Tue, 12 Feb 2013 10:50:44 -0500
Message-ID: <22027.1360684244@sss.pgh.pa.us> (raw)
In-Reply-To: <5119F0F7.2030204@2ndquadrant.com>
References: <EDDA5C6D-77E3-4C56-B33B-277E7FB32A12@hub.org>
	<401084E5E73F4241A44F3C9E6FD794289CE24D03@exch-01>
	<CAPPfruyta0A0xGhG4Zh785sS0_FZ8GczzcjZGXo2yfPhaDxuaA@mail.gmail.com>
	<28690.1360299322@sss.pgh.pa.us>
	<5119F0F7.2030204@2ndquadrant.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Craig Ringer <craig@2ndquadrant.com> writes:
> On 02/08/2013 12:55 PM, Tom Lane wrote:
>> AFAIK this is just business as usual with JDBC: setString() implies that
>> the parameter is of a string type.

> Well, it means that it's a type compatible with a java.lang.String .
> JDBC doesn't say much about the database-side type.

> It's my strong view that we should accept setString(...) for any
> string-like type, like xml, json, domains of text, and so on - or at
> least provide an easy, no-superuser-required way to tell Pg to do so.

The difficulty I've got with that is that there are only two kinds of
literal in SQL, namely numbers and strings, so that "it looks like a
string" applies to absolutely every non-numeric type.  If we go down
this road we'll end up allowing implicit casts from text to (at least)
every non-numeric type, which will be pretty much fatal for type
checking purposes.

IIRC, there's already a hack to tell the JDBC driver to mark setString
parameters as "unknown" rather than "text", which seems to me to be
a much less dangerous way of getting the lenient behavior when you want
it.

			regards, tom lane


-- 
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 (21+ messages)  latest in thread

Message-ID: <22027.1360684244@sss.pgh.pa.us>
Permalink:  ../22027.1360684244@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22027.1360684244@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, craig@2ndquadrant.com, pgsql@tomd.cc, dhudson@redcom.com, scrappy@hub.org, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] JPA + enum == Exception
  In-Reply-To: <22027.1360684244@sss.pgh.pa.us>
  References: <EDDA5C6D-77E3-4C56-B33B-277E7FB32A12@hub.org> <401084E5E73F4241A44F3C9E6FD794289CE24D03@exch-01> <CAPPfruyta0A0xGhG4Zh785sS0_FZ8GczzcjZGXo2yfPhaDxuaA@mail.gmail.com> <28690.1360299322@sss.pgh.pa.us> <5119F0F7.2030204@2ndquadrant.com> <22027.1360684244@sss.pgh.pa.us>

* 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