BUG #1267: Suggest TEXTOID parameters be treated like UNKNOWNOID

From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1267: Suggest TEXTOID parameters be treated like UNKNOWNOID
Date: 2004-09-23 12:09:02
Message-ID: 20040923120902.DAFD25A103F@www.postgresql.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1267
Logged by: Colin Chapman

Email address: c0linchapman(at)btinternet(dot)com

PostgreSQL version: 8.0 Beta

Operating system: fedora linux

Description: Suggest TEXTOID parameters be treated like UNKNOWNOID

Details:

postgresql-8.0.0beta2

JSP likes to transfer data in parameters as text. When putting values into
a int column you get exception

this can be demonstrated by.

create table d ( numb int );
insert into d values ( '1' );
insert into d values ( '2'::text );
drop table d;

--- ./parse_coerce.c 2004-08-29 06:06:44.000000000 +0100
+++ /usr/local/postgresql-8.0.0beta2/src/backend/parser/parse_coerce.c
2004-09-23 13:05:34.383199696 +0100
@@ -137,7 +137,7 @@
/* NB: we do NOT want a RelabelType here */
return node;
}
- if (inputTypeId == UNKNOWNOID && IsA(node, Const))
+ if ( ( ( ( inputTypeId == UNKNOWNOID) || (inputTypeId == TEXTOID ) )
&& IsA(node, Const))&& IsA(node, Const) )
{
/*
* Input is a string constant with previously undetermined
type.
@@ -197,7 +197,7 @@

return result;
}
- if (inputTypeId == UNKNOWNOID && IsA(node, Param) &&
+ if ( ( ( inputTypeId == UNKNOWNOID ) || ( inputTypeId == TEXTOID ) )
&& IsA(node, Param) &&
((Param *) node)->paramkind == PARAM_NUM &&
pstate != NULL && pstate->p_variableparams)
{
@@ -220,7 +220,7 @@

(errcode(ERRCODE_UNDEFINED_PARAMETER),
errmsg("there is no parameter $%d",
paramno)));

- if (toppstate->p_paramtypes[paramno - 1] == UNKNOWNOID)
+ if ( (toppstate->p_paramtypes[paramno - 1] == UNKNOWNOID) ||
(toppstate->p_paramtypes[paramno - 1] == TEXTOID ) )
{
/* We've successfully resolved the type */
toppstate->p_paramtypes[paramno - 1] = targetTypeId;
@@ -373,7 +373,7 @@
* If input is an untyped string constant, assume we can
convert
* it to anything.
*/
- if (inputTypeId == UNKNOWNOID)
+ if ( ( inputTypeId == UNKNOWNOID) || (inputTypeId ==
TEXTOID ) )
continue;

/*

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2004-09-23 14:15:45 Re: BUG #1266: Improper unique constraint / MVCC activities
Previous Message PostgreSQL Bugs List 2004-09-23 08:58:04 BUG #1266: Improper unique constraint / MVCC activities within single transaction