From 9606f36210542ebc2dd6b040830f3c6c5859a4a6 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 7 Mar 2000 23:30:53 +0000 Subject: [PATCH] Someone (probably me) forgot about handling of typecasts applied to parameters. --- src/backend/parser/parse_expr.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index d0ac448732..e1e8619972 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.71 2000/02/26 21:11:10 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.72 2000/03/07 23:30:53 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -78,19 +78,21 @@ transformExpr(ParseState *pstate, Node *expr, int precedence) ParamNo *pno = (ParamNo *) expr; int paramno = pno->number; Oid toid = param_type(paramno); - Param *param; + Param *param = makeNode(Param); if (!OidIsValid(toid)) elog(ERROR, "Parameter '$%d' is out of range", paramno); - param = makeNode(Param); param->paramkind = PARAM_NUM; param->paramid = (AttrNumber) paramno; param->paramname = ""; - param->paramtype = (Oid) toid; - param->param_tlist = (List *) NULL; + param->paramtype = toid; + param->param_tlist = NIL; result = transformIndirection(pstate, (Node *) param, pno->indirection); - /* XXX what about cast (typename) applied to Param ??? */ + /* cope with typecast applied to param */ + if (pno->typename != NULL) + result = parser_typecast_expression(pstate, result, + pno->typename); break; } case T_TypeCast: @@ -732,6 +734,7 @@ exprTypmod(Node *expr) * We assume that a two-argument function named for a datatype, whose * output and first argument types are that datatype, and whose second * input is an int32 constant, represents a forced length coercion. + * * XXX It'd be better if the parsetree retained some explicit indication * of the coercion, so we didn't need these heuristics. */ -- 2.40.0