Re: uuid values as parameters - Mailing list pgsql-jdbc

From Florian Weimer
Subject Re: uuid values as parameters
Date
Msg-id 82eid76pl6.fsf@mid.bfk.de
Whole thread Raw
In response to Re: uuid values as parameters  (Lew <noone@lewscanon.com>)
List pgsql-jdbc
* 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

pgsql-jdbc by date:

Previous
From: Kyran O Reilly
Date:
Subject: Re: Can't connect to posgresql through the jdbc driver
Next
From: Jochen Terstiege
Date:
Subject: JDBC driver method setClob always uses getAsciiStream()