diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-08-16 20:33:01 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-08-16 20:33:01 -0400 |
commit | 0bb51aa96783e8a6c473c2b5e3725e23e95db834 (patch) | |
tree | f4d4077257f5a4937fefafd0fe6f914f5e4027fd /src/backend/nodes/outfuncs.c | |
parent | 4bc4cfe3bd186b4a1d1b01279bfd0e6ab11268b2 (diff) |
Improve parsetree representation of special functions such as CURRENT_DATE.
We implement a dozen or so parameterless functions that the SQL standard
defines special syntax for. Up to now, that was done by converting them
into more or less ad-hoc constructs such as "'now'::text::date". That's
messy for multiple reasons: it exposes what should be implementation
details to users, and performance is worse than it needs to be in several
cases. To improve matters, invent a new expression node type
SQLValueFunction that can represent any of these parameterless functions.
Bump catversion because this changes stored parsetrees for rules.
Discussion: <30058.1463091294@sss.pgh.pa.us>
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
-rw-r--r-- | src/backend/nodes/outfuncs.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index acaf4ea5ebc..1fab807772c 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -1424,6 +1424,17 @@ _outMinMaxExpr(StringInfo str, const MinMaxExpr *node) } static void +_outSQLValueFunction(StringInfo str, const SQLValueFunction *node) +{ + WRITE_NODE_TYPE("SQLVALUEFUNCTION"); + + WRITE_ENUM_FIELD(op, SQLValueFunctionOp); + WRITE_OID_FIELD(type); + WRITE_INT_FIELD(typmod); + WRITE_LOCATION_FIELD(location); +} + +static void _outXmlExpr(StringInfo str, const XmlExpr *node) { WRITE_NODE_TYPE("XMLEXPR"); @@ -3522,6 +3533,9 @@ outNode(StringInfo str, const void *obj) case T_MinMaxExpr: _outMinMaxExpr(str, obj); break; + case T_SQLValueFunction: + _outSQLValueFunction(str, obj); + break; case T_XmlExpr: _outXmlExpr(str, obj); break; |