Re: Row pattern recognition

Tatsuo Ishii <ishii@postgresql.org>

From: Tatsuo Ishii <ishii@postgresql.org>
To: assam258@gmail.com
Cc: jian.universality@gmail.com, 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-20T09:58:25Z
Lists: pgsql-hackers
Hi Henson,

> rest.  So evaluating its DEFINE -- option (b) -- would mean running a clause
> the standard tells us to ignore.

Right.

> Agreed, and the parallel is convincing.  An unused window already escapes
> the negative-frame-offset check, so singling out DEFINE as the one clause
> that must fire regardless would be inconsistent with how the rest of an
> unused window already behaves.
> 
> This also matches the planner: select_active_windows() drops any window with
> no referencing WindowFunc, and its comment already cites the same <window
> clause> General Rules (General Rule 4) as its basis.
> 
> Either way, the disregard rule governs only execution.  A failure raised in
> the parser, transform, rewrite, or planner is a separate, static layer the
> rule does not touch.  And at execution there is nothing to evaluate: an
> unused window is never turned into a WindowAgg node, so its DEFINE is never
> reached.

Yes, the rule only applies to execution. I think what we do in other
phases is implementation dependent.

> So I'm convinced -- let's keep (a), the current behavior, and I'll treat
> this open question as closed, with no patch change.  For the record, the two
> halves stay cleanly separated: the RPR DEFINE volatility check still visits
> every window clause at preprocessing (independent of select_active_windows),
> while run-time DEFINE evaluation happens only for windows that survive it.
> 
> Thanks for digging up the standard text.

You are welcome.  Please feel free to ask me if you want to know what
9075-2 says about someting.

Regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Adjust cross-version upgrade tests for seg_out() fix

  2. Rationalize error comments in partition split/merge tests

  3. Add fast path for foreign key constraint checks

  4. Fix assorted pretty-trivial memory leaks in the backend.

  5. Add temporal FOREIGN KEY contraints

  6. Add trailing commas to enum definitions

  7. Remove obsolete executor cleanup code