|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.71 2000/02/26 21:11:10 tgl Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.72 2000/03/07 23:30:53 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -78,19 +78,21 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
|
78 | 78 | ParamNo *pno = (ParamNo *) expr;
|
79 | 79 | int paramno = pno->number;
|
80 | 80 | Oid toid = param_type(paramno);
|
81 |
| - Param *param; |
| 81 | + Param *param = makeNode(Param); |
82 | 82 |
|
83 | 83 | if (!OidIsValid(toid))
|
84 | 84 | elog(ERROR, "Parameter '$%d' is out of range", paramno);
|
85 |
| - param = makeNode(Param); |
86 | 85 | param->paramkind = PARAM_NUM;
|
87 | 86 | param->paramid = (AttrNumber) paramno;
|
88 | 87 | param->paramname = "<unnamed>";
|
89 |
| - param->paramtype = (Oid) toid; |
90 |
| - param->param_tlist = (List *) NULL; |
| 88 | + param->paramtype = toid; |
| 89 | + param->param_tlist = NIL; |
91 | 90 | result = transformIndirection(pstate, (Node *) param,
|
92 | 91 | pno->indirection);
|
93 |
| - /* XXX what about cast (typename) applied to Param ??? */ |
| 92 | + /* cope with typecast applied to param */ |
| 93 | + if (pno->typename != NULL) |
| 94 | + result = parser_typecast_expression(pstate, result, |
| 95 | + pno->typename); |
94 | 96 | break;
|
95 | 97 | }
|
96 | 98 | case T_TypeCast:
|
@@ -732,6 +734,7 @@ exprTypmod(Node *expr)
|
732 | 734 | * We assume that a two-argument function named for a datatype, whose
|
733 | 735 | * output and first argument types are that datatype, and whose second
|
734 | 736 | * input is an int32 constant, represents a forced length coercion.
|
| 737 | + * |
735 | 738 | * XXX It'd be better if the parsetree retained some explicit indication
|
736 | 739 | * of the coercion, so we didn't need these heuristics.
|
737 | 740 | */
|
|
0 commit comments