1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +03:00

Create a new parsetree node type, TypeCast, so that transformation of

SQL cast constructs can be performed during expression transformation
instead of during parsing.  This allows constructs like x::numeric(9,2)
and x::int2::float8 to behave as one would expect.
This commit is contained in:
Tom Lane
2000-01-17 00:14:49 +00:00
parent e0bd60171a
commit 49528361f5
10 changed files with 242 additions and 132 deletions

View File

@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.102 2000/01/14 00:53:21 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.103 2000/01/17 00:14:47 tgl Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@ -190,6 +190,15 @@ _outTypeName(StringInfo str, TypeName *node)
_outNode(str, node->arrayBounds);
}
static void
_outTypeCast(StringInfo str, TypeCast *node)
{
appendStringInfo(str, " TYPECAST :arg ");
_outNode(str, node->arg);
appendStringInfo(str, " :typename ");
_outNode(str, node->typename);
}
static void
_outIndexElem(StringInfo str, IndexElem *node)
{
@ -1292,6 +1301,8 @@ _outAConst(StringInfo str, A_Const *node)
{
appendStringInfo(str, "CONST ");
_outValue(str, &(node->val));
appendStringInfo(str, " :typename ");
_outNode(str, node->typename);
}
static void
@ -1400,6 +1411,9 @@ _outNode(StringInfo str, void *obj)
case T_TypeName:
_outTypeName(str, obj);
break;
case T_TypeCast:
_outTypeCast(str, obj);
break;
case T_IndexElem:
_outIndexElem(str, obj);
break;