Re: Row pattern recognition

From: Henson Choi <assam258(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Tatsuo Ishii <ishii(at)postgresql(dot)org>, zsolt(dot)parragi(at)percona(dot)com, sjjang112233(at)gmail(dot)com, vik(at)postgresfriends(dot)org, er(at)xs4all(dot)nl, jacob(dot)champion(at)enterprisedb(dot)com, david(dot)g(dot)johnston(at)gmail(dot)com, peter(at)eisentraut(dot)org, li(dot)evan(dot)chao(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org, 신성준 <shinsj4653(at)gmail(dot)com>
Subject: Re: Row pattern recognition
Date: 2026-09-08 04:36:45
Message-ID: CAAAe_zA0NOHKkvojRCdzYnaHLd87new3HQR7d+AXoxfSTVvqxg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi jian,

Thank you for reading it that closely.

> IMHO, src/backend/executor/README.rpr should focus on something that's
not easy
> to understand for users with some knowledge of the PostgreSQL codebase

Agreed. A section earns its place when what it describes differs from
how the rest of the tree does the same thing. Most of what you name
fails that.

> This process is quite common, since other nodes do something similar.

IV-6 goes. It is already written beside the code -- above
RPRPatternElement in plannodes.h, and at the read in readfuncs.c.

> BTW, "serialization" is not the usual word here; we generally use
> "deparse" for ruleutils.

The section is gone, so the name goes with it.

> This part doesn't need mentioning; it should be fine even if omitted
> from the doc, i think.

IV-2a goes. One sentence stays: the depth test runs on entry to each
node, so the one-byte RPRDepth cannot wrap.

> +XIII-5. Where Volatility Is Rejected
> Common routine; no need to mention in README.rpr

The first half goes; mainline moved the same check for the same
reason in a272a58b942. What stays is why the restriction exists:
the NFA evaluates a DEFINE at most once per row and caches it, so the
number of evaluations is not something a query can rely on.

> +XIV-3. Pattern Variable Quoting
> Common routine; no need to mention in README.rpr.

This one stays. quote_pattern_variable() quotes permute although
PERMUTE is unreserved, and the same variable prints bare in DEFINE and
quoted in PATTERN.

> +III-6. What a DEFINE Expression May Not Contain
> + III-7. Query Jumbling
> Common routine; it doesn't need mentioning in README.rpr.

III-6 goes; what the later phases lean on is already in the comment
above the pull_var_clause() call in allpaths.c.

III-7 stays. TargetEntry.resname is query_jumble_ignore everywhere in
the tree, and RPR is the one place that has to jumble it; without that
two DEFINE clauses differing only in variable order share a
pg_stat_statements entry.

> Also some of the text seems AI-generated and less readable.

Point at the passages and I will rewrite them.

> Therefore, I think many of the sections in README.rpr can be removed.

Three of the four I am cutting were already said elsewhere. The
README had drifted into repeating what the source carries.

Numbering moves a little. III-7 becomes III-6, and VI-3a becomes VI-4
with the sections after it shifting up.

Attached as wip-readme-cut-duplicated-sections-rev-001.txt. If
anything in it needs changing, could you amend it and send it back as
rev-002?

While we are settling this, how would it be to trade patches as
wip-*.txt with no numbers, and to number them 0XXX-*.txt in order once
we agree, for Tatsuo to review?

Best regards,
Henson

Attachment Content-Type Size
wip-readme-cut-duplicated-sections-rev-001.txt text/plain 13.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2026-09-08 04:42:59 Re: Two issues leading to discrepancies in FSM data on the standby server
Previous Message Michael Paquier 2026-09-08 04:35:35 Re: Missing dshash cleanup in pgstat_read_statsfile() after OOM