Hi Tatsuo, hi Jian,
Attached are 10 incremental patches on top of v47, covering the
follow-up plan ([A]..[D]) I sketched on 2026-05-05, Jian's two
coding-style items (trailing commas, outer parentheses; gram.y
folded into 0007), one comment-only patch (0009), and one trivial
cleanup (0010). Packaging into the next version is at your
discretion.
Patch summary:
- 0001 Add DEFINE non-volatile baseline to rpr_integration B9
Adds a STABLE/IMMUTABLE baseline ahead of the volatile
case so the rejection in 0002 is visible against a working
reference.
- 0002 Unify RPR DEFINE walkers and reject volatile callees
[A]. Collapses the four DEFINE walkers (parser / planner
/ executor) into one phase-tagged traversal and, on that
base, rejects volatile / NextValueExpr at parse-analysis.
STABLE / IMMUTABLE accepted. The offset runtime-constant
check is folded in; B9 flips to error-case and its XXX is
dropped.
- 0003 Cover RPR empty-match path with EXPLAIN tests; fix
stale XXX comments
[B]. Adds rpr_explain coverage that surfaces "NFA: N
matched (len 0/0/0.0)" so the NFA-found-but-empty-frame
path is regression-visible; replaces stale rpr_nfa XXXs.
- 0004 Reclassify DEFINE qualifier check and reword
diagnostic to "expression"
[D]. Tri-classifies (pattern var / range var / fall-
through) so unknown qualifiers fall through to the
standard "column does not exist" diagnostic. Reworded to
"expression" since the quoted token may include
indirection on composite types (e.g. (A.items).amount).
- 0005 Sync stale comments on DEFINE/PATTERN handling
validateRPRPatternVarCount() rejects DEFINE names not in
PATTERN, but comments / SELECT doc described it as
"collection" / "filtered during planning". Wording
aligned; XXX note's "column references" bumped to
"expressions" to match 0004. Comment + doc only.
- 0006 Add trailing commas to RPR enum definitions
Per Jian. RPRNavKind, RPRNavOffsetKind, RPRPatternNodeType.
- 0007 Remove optional outer parentheses from ereport() calls
in RPR files
Per Jian + Tatsuo's gram.y patch. 19 sites in
parse_rpr.c / optimizer/plan/rpr.c plus the gram.y sites.
- 0008 Add high-water mark tracking to NFA visited bitmap
reset
[C]. Resets only the touched span (O(span_words) instead
of O(numElements/64)), at the cost of two int16 comparisons
per visit. Semantics unchanged; happy to drop if you
prefer the simpler bulk reset.
- 0009 Document DEFINE subquery rejection as intentional
over-rejection
Comment-only. Records that ISO/IEC 9075-2 §4.18.4 /
6.17.4 (R010 / R020) permits a non-RPR, non-pattern-var-
correlated subquery in DEFINE, and that our blanket
rejection is deliberate over-rejection. The case
distinction (walk subquery Query for nested RPR; match
ColumnRef qualifiers against ancestor p_rpr_pattern_vars)
is doable with existing infrastructure and left as future
work, not blocked on any other feature.
- 0010 Remove duplicate #include in nodeWindowAgg.c
"common/int.h" was included twice and the first occurrence
was misplaced between catalog/* headers. Drops the
misplaced first; the second sits at the correct
alphabetical position.
Still deferred:
- B7 Recursive CTE XXX: pending community input on the
§4.18.5 / 6.17.5 interpretation.
Please let me know if any of 0001-0010 looks misjudged or if you
would prefer a different slicing.
Best regards,
Henson