1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +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:
Tom Lane
2016-08-16 20:33:01 -04:00
parent 4bc4cfe3bd
commit 0bb51aa967
24 changed files with 626 additions and 168 deletions

View File

@@ -619,6 +619,17 @@ _equalMinMaxExpr(const MinMaxExpr *a, const MinMaxExpr *b)
return true;
}
static bool
_equalSQLValueFunction(const SQLValueFunction *a, const SQLValueFunction *b)
{
COMPARE_SCALAR_FIELD(op);
COMPARE_SCALAR_FIELD(type);
COMPARE_SCALAR_FIELD(typmod);
COMPARE_LOCATION_FIELD(location);
return true;
}
static bool
_equalXmlExpr(const XmlExpr *a, const XmlExpr *b)
{
@@ -2842,6 +2853,9 @@ equal(const void *a, const void *b)
case T_MinMaxExpr:
retval = _equalMinMaxExpr(a, b);
break;
case T_SQLValueFunction:
retval = _equalSQLValueFunction(a, b);
break;
case T_XmlExpr:
retval = _equalXmlExpr(a, b);
break;