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 972A39FA5FC for ; Tue, 27 Jun 2006 19:50:03 -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 13858-04 for ; Tue, 27 Jun 2006 19:49:54 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tada.se (1-1-2-48a.rny.sth.bostream.se [82.182.133.12]) by postgresql.org (Postfix) with ESMTP id E33769F9DCC for ; Tue, 27 Jun 2006 19:49:53 -0300 (ADT) Received: from [127.0.0.1] (unverified [127.0.0.1]) by tada.se (SurgeMail 3.7b3) with ESMTP id 503 for multiple; Wed, 28 Jun 2006 00:49:52 +0200 Message-ID: <44A1B610.3020801@tada.se> Date: Wed, 28 Jun 2006 00:49:52 +0200 From: Thomas Hallgren User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Tom Lane CC: 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> <8536.1151447483@sss.pgh.pa.us> In-Reply-To: <8536.1151447483@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Server: High Performance Mail Server - http://surgemail.com r=849097733 X-Authenticated-User: thomas@tada.se X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/123 X-Sequence-Number: 15403 Tom Lane wrote: > The real point here is that the JDBC driver is doing something to prompt > the parser to resolve the types of parameter symbols in particular ways, > and (I gather) you're doing something different. If you want to match > the results they get, then you need to supply the same type information > for parameter symbols to SPI_prepare as they put into Parse messages. > > My mistake. I thought that given a statement like: SELECT p.name FROM people p WHERE p.zipcode = ? the actual type returned by SPI_getargtype would be inferred by the expression 'p.zipcode'. I guess that's not the case. Instead I need to provide the information earlier, like: SELECT p.name FROM people p WHERE p.zipcode = ?::varchar is that correct? If so, is there any way that I can automatically infer the best type? Regards, Thomas Hallgren