Re: BUG #2811: Error determining param type in prepared statement of unused variable

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ross Cohen <rcohen(at)snurgle(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2811: Error determining param type in prepared statement of unused variable
Date: 2006-12-07 23:26:59
Message-ID: 21791.1165534019@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ross Cohen <rcohen(at)snurgle(dot)org> writes:
> On Wed, Dec 06, 2006 at 05:55:32PM -0500, Tom Lane wrote:
>> "Ross Cohen" <rcohen(at)snurgle(dot)org> writes:
>>> PREPARE demo (unknown) AS SELECT 1;
>>> ERROR: could not determine data type of parameter $1
>>
>> This doesn't seem like a bug to me. The parser needs to be able to
>> resolve the types of any unknown parameters, and you've not given it
>> enough information to do that.

> It's not a bug, it's a feature request.

One man's feature is another one's bug ;-). The problem here is that
if we don't reject cases where parameters go unresolved, then we will
sometimes send back UNKNOWN as the "resolved" parameter type in Describe
Statement (the protocol-level message that is), and some client
libraries might spit up on that, because they won't know what to do with
the corresponding parameter value. I recall a discussion on the jdbc
list a few months ago asking whether this would be OK, but they seemed
to think it wasn't a good idea.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-12-08 00:42:12 Re: BUG #2817: Mixing spi_prepare and spi_exec_query causes postgresql to terminate itself on bad argument types
Previous Message Tom Lane 2006-12-07 19:36:11 Re: BUG #2807: constraint violation