nocfbot-0045-Drop-redundant-parentheses-from-row-pattern-recog.txt
text/plain
Filename: nocfbot-0045-Drop-redundant-parentheses-from-row-pattern-recog.txt
Type: text/plain
Part: 44
Message:
Re: Row pattern recognition
From 427916e331cd97c6ee68e3e09b3ee1ccfcb14cb3 Mon Sep 17 00:00:00 2001
From: Henson Choi <assam258@gmail.com>
Date: Fri, 5 Jun 2026 11:29:33 +0900
Subject: [PATCH 45/68] Drop redundant parentheses from row pattern recognition
ereports
The row pattern recognition patch added a number of ereport() calls
that still wrap their auxiliary functions in the optional outer
parentheses. The newer style omits them, and most of the patch --
all of parse_rpr.c, for one -- already does.
Convert the remaining calls to the parenthesis-free style so the
feature is internally consistent: the DEFINE-clause checks in
ParseFuncOrColumn() and transformColumnRef(), the navigation offset
checks in execExprInterp.c, and the navigation placeholder window
functions in windowfuncs.c. Pre-existing core ereport() calls are
left untouched.
No behavior change.
---
src/backend/executor/execExprInterp.c | 16 +++++++-------
src/backend/parser/parse_expr.c | 16 +++++++-------
src/backend/parser/parse_func.c | 8 +++----
src/backend/utils/adt/windowfuncs.c | 32 +++++++++++++--------------
4 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c
index 324b9a962a8..805c8583fb2 100644
--- a/src/backend/executor/execExprInterp.c
+++ b/src/backend/executor/execExprInterp.c
@@ -6026,15 +6026,15 @@ rpr_nav_get_compound_offset(ExprEvalStep *op)
if (op->d.rpr_nav.offset_isnull[1])
ereport(ERROR,
- (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
- errmsg("row pattern navigation offset must not be null")));
+ errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
+ errmsg("row pattern navigation offset must not be null"));
val = DatumGetInt64(op->d.rpr_nav.offset_value[1]);
if (val < 0)
ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("row pattern navigation offset must not be negative")));
+ errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("row pattern navigation offset must not be negative"));
return val;
}
@@ -6071,15 +6071,15 @@ ExecEvalRPRNavSet(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
{
if (*op->d.rpr_nav.offset_isnull)
ereport(ERROR,
- (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
- errmsg("row pattern navigation offset must not be null")));
+ errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
+ errmsg("row pattern navigation offset must not be null"));
offset = DatumGetInt64(*op->d.rpr_nav.offset_value);
if (offset < 0)
ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("row pattern navigation offset must not be negative")));
+ errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("row pattern navigation offset must not be negative"));
}
else
{
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 78abdc88f86..2344aaef9ae 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -666,17 +666,17 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
if (is_pattern_var)
ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("pattern variable qualified expression \"%s\" is not supported in DEFINE clause",
- NameListToString(cref->fields)),
- parser_errposition(pstate, cref->location)));
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("pattern variable qualified expression \"%s\" is not supported in DEFINE clause",
+ NameListToString(cref->fields)),
+ parser_errposition(pstate, cref->location));
else if (refnameNamespaceItem(pstate, NULL, qualifier,
cref->location, NULL) != NULL)
ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("range variable qualified expression \"%s\" is not allowed in DEFINE clause",
- NameListToString(cref->fields)),
- parser_errposition(pstate, cref->location)));
+ errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("range variable qualified expression \"%s\" is not allowed in DEFINE clause",
+ NameListToString(cref->fields)),
+ parser_errposition(pstate, cref->location));
/* else: unknown qualifier -- fall through to normal resolution */
}
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index 49646b728c6..8cae9ba52b6 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -789,10 +789,10 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
/* Not a column projection -- report error */
ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("cannot use %s outside a DEFINE clause",
- NameListToString(funcname)),
- parser_errposition(pstate, location)));
+ errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("cannot use %s outside a DEFINE clause",
+ NameListToString(funcname)),
+ parser_errposition(pstate, location));
}
/* build the appropriate output structure */
diff --git a/src/backend/utils/adt/windowfuncs.c b/src/backend/utils/adt/windowfuncs.c
index 46e7a03a666..3869f6c8994 100644
--- a/src/backend/utils/adt/windowfuncs.c
+++ b/src/backend/utils/adt/windowfuncs.c
@@ -739,8 +739,8 @@ Datum
window_prev(PG_FUNCTION_ARGS)
{
ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot use PREV() outside a DEFINE clause")));
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot use PREV() outside a DEFINE clause"));
PG_RETURN_NULL(); /* not reached */
}
@@ -753,8 +753,8 @@ Datum
window_next(PG_FUNCTION_ARGS)
{
ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot use NEXT() outside a DEFINE clause")));
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot use NEXT() outside a DEFINE clause"));
PG_RETURN_NULL(); /* not reached */
}
@@ -767,8 +767,8 @@ Datum
window_prev_offset(PG_FUNCTION_ARGS)
{
ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot use PREV() outside a DEFINE clause")));
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot use PREV() outside a DEFINE clause"));
PG_RETURN_NULL(); /* not reached */
}
@@ -781,8 +781,8 @@ Datum
window_next_offset(PG_FUNCTION_ARGS)
{
ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot use NEXT() outside a DEFINE clause")));
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot use NEXT() outside a DEFINE clause"));
PG_RETURN_NULL(); /* not reached */
}
@@ -795,8 +795,8 @@ Datum
window_first(PG_FUNCTION_ARGS)
{
ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot use FIRST() outside a DEFINE clause")));
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot use FIRST() outside a DEFINE clause"));
PG_RETURN_NULL(); /* not reached */
}
@@ -809,8 +809,8 @@ Datum
window_last(PG_FUNCTION_ARGS)
{
ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot use LAST() outside a DEFINE clause")));
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot use LAST() outside a DEFINE clause"));
PG_RETURN_NULL(); /* not reached */
}
@@ -823,8 +823,8 @@ Datum
window_first_offset(PG_FUNCTION_ARGS)
{
ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot use FIRST() outside a DEFINE clause")));
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot use FIRST() outside a DEFINE clause"));
PG_RETURN_NULL(); /* not reached */
}
@@ -837,7 +837,7 @@ Datum
window_last_offset(PG_FUNCTION_ARGS)
{
ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot use LAST() outside a DEFINE clause")));
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot use LAST() outside a DEFINE clause"));
PG_RETURN_NULL(); /* not reached */
}
--
2.50.1 (Apple Git-155)