From 86547ec75bcbefd20cc3bddc7038d128a7f25cad Mon Sep 17 00:00:00 2001 From: Jan Nidzwetzki Date: Thu, 1 Feb 2024 15:23:47 +0100 Subject: [PATCH] Handle NamedArgs --- tsl/src/continuous_aggs/common.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tsl/src/continuous_aggs/common.c b/tsl/src/continuous_aggs/common.c index 2ddb61616ad..898cdb6f553 100644 --- a/tsl/src/continuous_aggs/common.c +++ b/tsl/src/continuous_aggs/common.c @@ -277,7 +277,6 @@ caggtimebucket_validate(CAggTimebucketInfo *tbinfo, List *groupClause, List *tar DirectFunctionCall1(date_timestamp, const_arg->constvalue)); } break; - // TODO: Handle NamedArgs case TIMESTAMPOID: /* Origin is always 3rd arg for timestamp variants. */ if (list_length(fe->args) == 3) @@ -292,18 +291,10 @@ caggtimebucket_validate(CAggTimebucketInfo *tbinfo, List *groupClause, List *tar /* Origin can be 3rd or 4th arg for timestamptz variants. */ if (list_length(fe->args) >= 3 && exprType(lthird(fe->args)) == TIMESTAMPTZOID) { + Node *arg = lthird(fe->args); custom_origin = true; - if (IsA(lthird(fe->args), Const)) - { - tbinfo->origin = - DatumGetTimestampTz(castNode(Const, lthird(fe->args))->constvalue); - } - else if (IsA(lthird(fe->args), NamedArgExpr)) - { - Const *constval = check_time_bucket_argument(lthird(fe->args), "third"); - - tbinfo->origin = DatumGetTimestampTz(constval->constvalue); - } + Const *constval = check_time_bucket_argument(arg, "third"); + tbinfo->origin = DatumGetTimestampTz(constval->constvalue); } else if (list_length(fe->args) >= 4 && exprType(lfourth(fe->args)) == TIMESTAMPTZOID)