Re: Row pattern recognition
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: assam258@gmail.com
Cc: Tatsuo Ishii <ishii@postgresql.org>, zsolt.parragi@percona.com,
sjjang112233@gmail.com, vik@postgresfriends.org, er@xs4all.nl, jacob.champion@enterprisedb.com, david.g.johnston@gmail.com, peter@eisentraut.org, li.evan.chao@gmail.com, pgsql-hackers@postgresql.org
Date: 2026-06-15T06:32:01Z
Lists: pgsql-hackers
Attachments
- v48-0001-v48-misc-refactoring.nocfbot (application/octet-stream)
Hi.
More review based on https://github.com/assam258-5892/postgres/commits/RPR
remove_unused_subquery_outputs
``````
if (dvar->varno == var->varno &&
dvar->varattno == var->varattno &&
dvar->varlevelsup == var->varlevelsup)
{
needed_by_define = true;
break;
}
``````
dvar, var both can be whole-row Vars, but this seems to work for whole-row vars.
We need some simple regress tests for cases where both are whole-row
vars or one of them is a whole-row var.
I've attached a patch with some refactoring. The below is detailed
commit message.
--------------------------------------------------------------------
RPRNavExpr->resulttype should also marked as pg_node_attr(query_jumble_ignore)
collectPatternVariables is not needed.
The parser already ensures every DEFINE variable appears in PATTERN,
so there is nothing to filter.
Also, we don't really do anything special (like make a dummy Const) regarding
PATTERN variables that not appearing in the DEFINE clause.
See nfa_evaluate_row the for loop break.
buildDefineVariableList is trivial. No need to export it as an
external function.
Rename WindowAggState.defineClauseList to defineClauseExprs
Minor refactoring of regress test comments.
Flatten a needlessly nested block in show_window_def().
Replace a post-loop ListCell NULL check in
remove_unused_subquery_outputs() with a boolean flag.
Reduce the number of arguments in make_windowagg.
--------------------------------------------------------------------
--
jian
https://www.enterprisedb.com/
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Adjust cross-version upgrade tests for seg_out() fix
- 3e3d7875e956 19 (unreleased) cited
-
Rationalize error comments in partition split/merge tests
- ecb2508aaf9b 19 (unreleased) cited
-
Add fast path for foreign key constraint checks
- 2da86c1ef9b5 19 (unreleased) cited
-
Fix assorted pretty-trivial memory leaks in the backend.
- e78d1d6d47dc 19 (unreleased) cited
-
Add temporal FOREIGN KEY contraints
- 89f908a6d0ac 18.0 cited
-
Add trailing commas to enum definitions
- 611806cd726f 17.0 cited
-
Remove obsolete executor cleanup code
- d060e921ea5a 17.0 cited