dbTalk Databases Forums  

[BUGS] BUG #2811: Error determining param type in prepared statement of unused variable

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2811: Error determining param type in prepared statement of unused variable in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ross Cohen
 
Posts: n/a

Default [BUGS] BUG #2811: Error determining param type in prepared statement of unused variable - 12-06-2006 , 02:23 PM







The following bug has been logged online:

Bug reference: 2811
Logged by: Ross Cohen
Email address: rcohen (AT) snurgle (DOT) org
PostgreSQL version: 8.2
Operating system: linux (fedora core 4, released RPMS)
Description: Error determining param type in prepared statement of
unused variable
Details:

Got this error:
ERROR: could not determine data type of parameter $1

However, $1 is never used in the query so this shouldn't be a problem. The
following query demonstrates the problem.

PREPARE demo (unknown) AS SELECT 1;

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2811: Error determining param type in prepared statement of unused variable - 12-06-2006 , 04:56 PM






"Ross Cohen" <rcohen (AT) snurgle (DOT) org> writes:
Quote:
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.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Reply With Quote
  #3  
Old   
Ross Cohen
 
Posts: n/a

Default Re: [BUGS] BUG #2811: Error determining param type in prepared statement of unused variable - 12-07-2006 , 04:14 PM



On Wed, Dec 06, 2006 at 05:55:32PM -0500, Tom Lane wrote:
Quote:
"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. It doesn't really need to be able
to resolve the type because the parameter will never be used. Yes, I'm being
lazy, it's possible for me to be more careful about what I pass in. On the
other hand, I think others would appreciate the ability to be this lazy,
as well.

Ross

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
  #4  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2811: Error determining param type in prepared statement of unused variable - 12-07-2006 , 05:27 PM



Ross Cohen <rcohen (AT) snurgle (DOT) org> writes:
Quote:
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

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.