nocfbot-0070-Clarify-the-non-trivial-quantifier-comments-in-ro.txt
text/plain
Filename: nocfbot-0070-Clarify-the-non-trivial-quantifier-comments-in-ro.txt
Type: text/plain
Part: 75
Message:
Re: Row pattern recognition
From 2a8ee8d13d587664b3e524ab43e37d06e144bfcb Mon Sep 17 00:00:00 2001
From: Henson Choi <assam258@gmail.com>
Date: Wed, 10 Jun 2026 16:26:02 +0900
Subject: [PATCH 70/77] Clarify the non-trivial quantifier comments in row
pattern recognition
Several comments in scanRPRPatternRecursive() and fillRPRPatternGroup()
guard group BEGIN/END elements on a "non-trivial quantifier" without
saying what trivial is. Spell out that it means the {1,1} case, matching
the guarding condition (node->min != 1 || node->max != 1). Comment-only,
no behavior change.
---
src/backend/optimizer/plan/rpr.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/backend/optimizer/plan/rpr.c b/src/backend/optimizer/plan/rpr.c
index 664c942e575..bf537d20c28 100644
--- a/src/backend/optimizer/plan/rpr.c
+++ b/src/backend/optimizer/plan/rpr.c
@@ -1062,7 +1062,11 @@ scanRPRPatternRecursive(RPRPatternNode *node, char **varNames, int *numVars,
break;
case RPR_PATTERN_GROUP:
- /* Add BEGIN element if group has non-trivial quantifier */
+
+ /*
+ * Add BEGIN element if group has non-trivial quantifier (not
+ * {1,1})
+ */
if (node->min != 1 || node->max != 1)
(*numElements)++;
@@ -1073,7 +1077,7 @@ scanRPRPatternRecursive(RPRPatternNode *node, char **varNames, int *numVars,
numVars, numElements, depth + 1, maxDepth);
}
- /* Add END element if group has non-trivial quantifier */
+ /* Add END element if group has non-trivial quantifier (not {1,1}) */
if (node->min != 1 || node->max != 1)
(*numElements)++;
break;
@@ -1231,7 +1235,7 @@ fillRPRPatternGroup(RPRPatternNode *node, RPRPattern *pat, int *idx, RPRDepth de
int beginIdx = -1;
bool bodyNullable = true;
- /* Add BEGIN marker if group has non-trivial quantifier */
+ /* Add BEGIN marker if group has non-trivial quantifier (not {1,1}) */
if (node->min != 1 || node->max != 1)
{
RPRPatternElement *elem = &pat->elements[*idx];
@@ -1259,7 +1263,7 @@ fillRPRPatternGroup(RPRPatternNode *node, RPRPattern *pat, int *idx, RPRDepth de
bodyNullable = false;
}
- /* Add group end marker if group has non-trivial quantifier */
+ /* Add group end marker if group has non-trivial quantifier (not {1,1}) */
if (node->min != 1 || node->max != 1)
{
RPRPatternElement *beginElem = &pat->elements[beginIdx];
--
2.50.1 (Apple Git-155)