Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id D42146327A3 for ; Mon, 6 Sep 2010 09:09:37 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 39352-04 for ; Mon, 6 Sep 2010 12:09:28 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx01.bfk.de (mx01.bfk.de [193.227.124.2]) by mail.postgresql.org (Postfix) with ESMTP id CEEA9632F63 for ; Mon, 6 Sep 2010 09:09:29 -0300 (ADT) Received: from mx00.int.bfk.de ([10.119.110.2]) by mx01.bfk.de with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) id 1OsaVp-0007Qg-Qs; Mon, 06 Sep 2010 12:09:25 +0000 Received: by bfk.de with local id 1OsaVp-0008PG-Kt; Mon, 06 Sep 2010 12:09:25 +0000 To: Lew Cc: pgsql-jdbc@postgresql.org Subject: Re: uuid values as parameters References: <6922363a-ac17-49da-a5bd-ac5d03653dde@x42g2000yqx.googlegroups.com> From: Florian Weimer Date: Mon, 06 Sep 2010 12:09:25 +0000 In-Reply-To: (Lew's message of "Sun\, 22 Aug 2010 11\:38\:36 -0400") Message-ID: <82eid76pl6.fsf@mid.bfk.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201009/6 X-Sequence-Number: 20876 * 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=3Dunspecified" to the JDBC URL. --=20 Florian Weimer BFK edv-consulting GmbH http://www.bfk.de/ Kriegsstra=DFe 100 tel: +49-721-96201-1 D-76133 Karlsruhe fax: +49-721-96201-99