X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id EAD069FA5E1 for ; Wed, 28 Jun 2006 03:20:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 83954-07 for ; Wed, 28 Jun 2006 03:20:06 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailrelay1.bredband.net (mailrelay1.bredband.net [195.54.107.83]) by postgresql.org (Postfix) with ESMTP id 515A79FA2F0 for ; Wed, 28 Jun 2006 03:20:05 -0300 (ADT) Received: from [192.168.1.100] (1-1-2-48a.rny.sth.bostream.se [82.182.133.12]) by mailrelay1.bredband.net (Postfix) with ESMTP id 2B3875082E8; Wed, 28 Jun 2006 08:23:03 +0200 (CEST) Message-ID: <44A21F93.2090007@tada.se> Date: Wed, 28 Jun 2006 08:20:03 +0200 From: Thomas Hallgren User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Oliver Jowett Cc: Tom Lane , Kris Jurka , "Pgsql-Jdbc@Postgresql.Org" Subject: Re: [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject References: <44A16388.3060108@tada.se> <44A1739A.2080102@tada.se> <26695.1151435851@sss.pgh.pa.us> <44A18A53.5000107@tada.se> <7957.1151442476@sss.pgh.pa.us> <44A1A285.6000900@tada.se> <44A1CB65.6020304@opencloud.com> In-Reply-To: <44A1CB65.6020304@opencloud.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/125 X-Sequence-Number: 15405 Oliver Jowett wrote: > Thomas Hallgren wrote: > >> Should this be considered a conscious flaw in the client driver >> motivated by the desire to limit the number of round trips? If it is, >> what would the best course of action be for me? Implement the same >> flaw although I don't have that problem? > > There is considerably more to it than trying to avoid an extra > round-trip (although that is part of it). If we're given a String > parameter, why should we interpret it as anything other than a String? > We don't really want to implement an any-type-to-any-other-type > conversion routine in the driver! > No, of course not. I fully appreciate the way you do it today. The whole discussion stems from a misunderstanding on my part. I thought that that type returned by the SPI_getargtype was inferred from its context within the query. As it turns out it isn't. > Nevertheless there is a "fix" here -- pass "stringtype=unspecified" as a > URL parameter in the JDBC URL and the driver will pass parameters set > via setString() with unspecified types. This was originally put in to > handle apps that expected to be able to setString("42") on an int > column, but it should deal with your particular situation too. Use at > your own risk. See > http://jdbc.postgresql.org/documentation/head/connect.html#connection-parameters > Right. Apparently, what I do is similar to using "stringtype-unspecified" always (and not just for string types either). My driver has some room for improvements :-) Anyway, thanks for helping me clearing this up. Now I know what to do. Regards, Thomas Hallgren