Skip site navigation (1) Skip section navigation (2)

Re: [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject

From: Thomas Hallgren <thomas(at)tada(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kris Jurka <books(at)ejurka(dot)com>, "Pgsql-Jdbc(at)Postgresql(dot)Org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject
Date: 2006-06-27 22:49:52
Message-ID: 44A1B610.3020801@tada.se (view raw or flat)
Thread:
Lists: pgsql-jdbc
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


In response to

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2006-06-28 00:20:53
Subject: Re: [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject
Previous:From: Tom LaneDate: 2006-06-27 22:31:23
Subject: Re: [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group