mirror of
https://github.com/postgres/postgres.git
synced 2025-07-18 17:42:25 +03:00
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>
This commit is contained in:
@ -1423,6 +1423,17 @@ _outMinMaxExpr(StringInfo str, const MinMaxExpr *node)
|
||||
WRITE_LOCATION_FIELD(location);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -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;
|
||||
|
Reference in New Issue
Block a user