pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Florian Weimer <fweimer@bfk.de>
To: Lew <noone@lewscanon.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: uuid values as parameters
Date: Mon, 06 Sep 2010 12:09:25 +0000
Message-ID: <82eid76pl6.fsf@mid.bfk.de> (raw)
In-Reply-To: <i4rg9h$j8l$1@news.albasani.net>
References: <6922363a-ac17-49da-a5bd-ac5d03653dde@x42g2000yqx.googlegroups.com>
	<i4rg9h$j8l$1@news.albasani.net>

* Lew:

> When you give the SQL parser a string literal, it knows that it might
> have to convert to the column type, and at that can only do so for
> column types that define a conversion for string literals.  When you
> give the parser a parameter to a prepared statement, you are adding
> the feature of strong type safety. You are actually depending on the
> parser to reject inputs of the wrong type. For it to accept a string
> value for the parameter would be a violation of that trust.

You usually can work around that by adding a type cast, as in
"?::uuid".

To get behavior which more closely matches those of other PostgreSQL
bindings, add "?stringtype=unspecified" to the JDBC URL.

-- 
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99



view thread (3+ messages)

Message-ID: <82eid76pl6.fsf@mid.bfk.de>
Permalink:  ../82eid76pl6.fsf@mid.bfk.de/
Also on:    postgresql.org/message-id/82eid76pl6.fsf@mid.bfk.de

 · 

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: fweimer@bfk.de, noone@lewscanon.com
  Subject: Re: uuid values as parameters
  In-Reply-To: <82eid76pl6.fsf@mid.bfk.de>
  References: <6922363a-ac17-49da-a5bd-ac5d03653dde@x42g2000yqx.googlegroups.com> <i4rg9h$j8l$1@news.albasani.net> <82eid76pl6.fsf@mid.bfk.de>

* 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