From 9fa12ddda62549a0e0225220745c3bf89434dab3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 10 Dec 2006 22:13:27 +0000 Subject: Add a paramtypmod field to Param nodes. This is dead weight for Params representing externally-supplied values, since the APIs that carry such values only specify type not typmod. However, for PARAM_SUBLINK Params it is handy to carry the typmod of the sublink's output column. This is a much cleaner solution for the recently reported 'could not find pathkey item to sort' and 'failed to find unique expression in subplan tlist' bugs than my original 8.2-compatible patch. Besides, someday we might want to support typmods for external parameters ... --- src/backend/parser/parse_expr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/backend/parser/parse_expr.c') diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 7c72ae9e22a..b1b6ea81456 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.198 2006/10/04 00:29:55 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.199 2006/12/10 22:13:26 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -572,6 +572,7 @@ transformParamRef(ParseState *pstate, ParamRef *pref) param->paramkind = PARAM_EXTERN; param->paramid = paramno; param->paramtype = toppstate->p_paramtypes[paramno - 1]; + param->paramtypmod = -1; return (Node *) param; } @@ -1180,6 +1181,7 @@ transformSubLink(ParseState *pstate, SubLink *sublink) param->paramkind = PARAM_SUBLINK; param->paramid = tent->resno; param->paramtype = exprType((Node *) tent->expr); + param->paramtypmod = exprTypmod((Node *) tent->expr); right_list = lappend(right_list, param); } @@ -1721,6 +1723,8 @@ exprTypmod(Node *expr) } } break; + case T_Param: + return ((Param *) expr)->paramtypmod; case T_FuncExpr: { int32 coercedTypmod; -- cgit v1.2.3