diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-02-20 21:32:16 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-02-20 21:32:16 +0000 |
commit | 57b30e8e226014c8d06bae0158e0c7fc679f700b (patch) | |
tree | 172a3052e6c88922d63726bacd092afac6bf053c /src/backend/parser/parse_expr.c | |
parent | bd8e071482e3c33876295aae5523fe57ce35025b (diff) | |
download | postgresql-57b30e8e226014c8d06bae0158e0c7fc679f700b.tar.gz postgresql-57b30e8e226014c8d06bae0158e0c7fc679f700b.zip |
Create a new expression node type RelabelType, which exists solely to
represent the result of a binary-compatible type coercion. At runtime
it just evaluates its argument --- but during type resolution, exprType
will pick up the output type of the RelabelType node instead of the type
of the argument. This solves some longstanding problems with dropped
type coercions, an example being 'select now()::abstime::int4' which
used to produce date-formatted output, not an integer, because the
coercion to int4 was dropped on the floor.
Diffstat (limited to 'src/backend/parser/parse_expr.c')
-rw-r--r-- | src/backend/parser/parse_expr.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 365378f4072..3fd3370672f 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.68 2000/02/15 03:37:47 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.69 2000/02/20 21:32:10 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -516,6 +516,7 @@ transformExpr(ParseState *pstate, Node *expr, int precedence) case T_Param: case T_Aggref: case T_ArrayRef: + case T_RelabelType: { result = (Node *) expr; break; @@ -627,6 +628,9 @@ exprType(Node *expr) case T_Param: type = ((Param *) expr)->paramtype; break; + case T_RelabelType: + type = ((RelabelType *) expr)->resulttype; + break; case T_SubLink: { SubLink *sublink = (SubLink *) expr; @@ -697,6 +701,9 @@ exprTypmod(Node *expr) } } break; + case T_RelabelType: + return ((RelabelType *) expr)->resulttypmod; + break; default: break; } |