pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kris Jurka <books@ejurka.com>
Cc: Vincent Risi <vince@bbd.co.za>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Could not determine data type of parameter $1
Date: Wed, 30 Aug 2006 09:05:42 -0400
Message-ID: <26409.1156943142@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.BSO.4.63.0608292151450.28706@leary2.csoft.net>
References: <44EEB4F4.2050202@bbd.co.za>
	<Pine.BSO.4.63.0608292151450.28706@leary2.csoft.net>

Kris Jurka <books@ejurka.com> writes:
> When given a timestamp parameter the jdbc driver does not know if it is 
> going to be used a timestamp with time zone or a timestamp without time 
> zone.  The driver passes it to the server as an unknown data type letting 
> the server figure out what to do with it.  Usually you'll have 
> timestampcol = ? or you're inserting into a timestamp field so the server 
> can easily determine the true datatype the parameter is being used at.  In 
> this case since it's just being sent back to the user the server cannot 
> determine the type and bails out.  You need to help it along with a cast: 
> "SELECT ?::timestamptz".

Hm, I wonder if we are being overly strict about this.  In the
non-prepared-statement scenario, you can do

	SELECT 'foo'

and the system just plays dumb and emits the string again --- it's
perfectly happy to report the datatype as UNKNOWN.  Is it reasonable to
allow the same treatment for parameter symbols, or will client code just
choke anyway if it sees the parameter type come back as UNKNOWN?

			regards, tom lane



view thread (29+ messages)  latest in thread

Message-ID: <26409.1156943142@sss.pgh.pa.us>
Permalink:  ../26409.1156943142@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26409.1156943142@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: tgl@sss.pgh.pa.us, books@ejurka.com, vince@bbd.co.za
  Subject: Re: Could not determine data type of parameter $1
  In-Reply-To: <26409.1156943142@sss.pgh.pa.us>
  References: <44EEB4F4.2050202@bbd.co.za> <Pine.BSO.4.63.0608292151450.28706@leary2.csoft.net> <26409.1156943142@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox