aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/parser/gram.y37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 50942267500..1e86aec72ee 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11234,10 +11234,15 @@ func_expr: func_name '(' ')' over_clause
* of type-input conversion functions. (As of PG 7.3
* that is actually possible, but not clear that we want
* to rely on it.)
+ *
+ * The token location is attached to the run-time
+ * typecast, not to the Const, for the convenience of
+ * pg_stat_statements (which doesn't want these constructs
+ * to appear to be replaceable constants).
*/
Node *n;
- n = makeStringConstCast("now", @1, SystemTypeName("text"));
- $$ = makeTypeCast(n, SystemTypeName("date"), -1);
+ n = makeStringConstCast("now", -1, SystemTypeName("text"));
+ $$ = makeTypeCast(n, SystemTypeName("date"), @1);
}
| CURRENT_TIME
{
@@ -11246,8 +11251,8 @@ func_expr: func_name '(' ')' over_clause
* See comments for CURRENT_DATE.
*/
Node *n;
- n = makeStringConstCast("now", @1, SystemTypeName("text"));
- $$ = makeTypeCast(n, SystemTypeName("timetz"), -1);
+ n = makeStringConstCast("now", -1, SystemTypeName("text"));
+ $$ = makeTypeCast(n, SystemTypeName("timetz"), @1);
}
| CURRENT_TIME '(' Iconst ')'
{
@@ -11257,10 +11262,10 @@ func_expr: func_name '(' ')' over_clause
*/
Node *n;
TypeName *d;
- n = makeStringConstCast("now", @1, SystemTypeName("text"));
+ n = makeStringConstCast("now", -1, SystemTypeName("text"));
d = SystemTypeName("timetz");
d->typmods = list_make1(makeIntConst($3, @3));
- $$ = makeTypeCast(n, d, -1);
+ $$ = makeTypeCast(n, d, @1);
}
| CURRENT_TIMESTAMP
{
@@ -11287,10 +11292,10 @@ func_expr: func_name '(' ')' over_clause
*/
Node *n;
TypeName *d;
- n = makeStringConstCast("now", @1, SystemTypeName("text"));
+ n = makeStringConstCast("now", -1, SystemTypeName("text"));
d = SystemTypeName("timestamptz");
d->typmods = list_make1(makeIntConst($3, @3));
- $$ = makeTypeCast(n, d, -1);
+ $$ = makeTypeCast(n, d, @1);
}
| LOCALTIME
{
@@ -11299,8 +11304,8 @@ func_expr: func_name '(' ')' over_clause
* See comments for CURRENT_DATE.
*/
Node *n;
- n = makeStringConstCast("now", @1, SystemTypeName("text"));
- $$ = makeTypeCast((Node *)n, SystemTypeName("time"), -1);
+ n = makeStringConstCast("now", -1, SystemTypeName("text"));
+ $$ = makeTypeCast((Node *)n, SystemTypeName("time"), @1);
}
| LOCALTIME '(' Iconst ')'
{
@@ -11310,10 +11315,10 @@ func_expr: func_name '(' ')' over_clause
*/
Node *n;
TypeName *d;
- n = makeStringConstCast("now", @1, SystemTypeName("text"));
+ n = makeStringConstCast("now", -1, SystemTypeName("text"));
d = SystemTypeName("time");
d->typmods = list_make1(makeIntConst($3, @3));
- $$ = makeTypeCast((Node *)n, d, -1);
+ $$ = makeTypeCast((Node *)n, d, @1);
}
| LOCALTIMESTAMP
{
@@ -11322,8 +11327,8 @@ func_expr: func_name '(' ')' over_clause
* See comments for CURRENT_DATE.
*/
Node *n;
- n = makeStringConstCast("now", @1, SystemTypeName("text"));
- $$ = makeTypeCast(n, SystemTypeName("timestamp"), -1);
+ n = makeStringConstCast("now", -1, SystemTypeName("text"));
+ $$ = makeTypeCast(n, SystemTypeName("timestamp"), @1);
}
| LOCALTIMESTAMP '(' Iconst ')'
{
@@ -11333,10 +11338,10 @@ func_expr: func_name '(' ')' over_clause
*/
Node *n;
TypeName *d;
- n = makeStringConstCast("now", @1, SystemTypeName("text"));
+ n = makeStringConstCast("now", -1, SystemTypeName("text"));
d = SystemTypeName("timestamp");
d->typmods = list_make1(makeIntConst($3, @3));
- $$ = makeTypeCast(n, d, -1);
+ $$ = makeTypeCast(n, d, @1);
}
| CURRENT_ROLE
{