mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
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.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.108 2000/02/15 20:49:09 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.109 2000/02/20 21:32:05 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every (plan) node in POSTGRES has an associated "out" routine which
|
||||
@ -770,6 +770,19 @@ _outSubLink(StringInfo str, SubLink *node)
|
||||
_outNode(str, node->subselect);
|
||||
}
|
||||
|
||||
/*
|
||||
* RelabelType
|
||||
*/
|
||||
static void
|
||||
_outRelabelType(StringInfo str, RelabelType *node)
|
||||
{
|
||||
appendStringInfo(str, " RELABELTYPE :arg ");
|
||||
_outNode(str, node->arg);
|
||||
|
||||
appendStringInfo(str, " :resulttype %u :resulttypmod %d ",
|
||||
node->resulttype, node->resulttypmod);
|
||||
}
|
||||
|
||||
/*
|
||||
* Array is a subclass of Expr
|
||||
*/
|
||||
@ -1496,6 +1509,9 @@ _outNode(StringInfo str, void *obj)
|
||||
case T_SubLink:
|
||||
_outSubLink(str, obj);
|
||||
break;
|
||||
case T_RelabelType:
|
||||
_outRelabelType(str, obj);
|
||||
break;
|
||||
case T_Array:
|
||||
_outArray(str, obj);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user