Re: Row pattern recognition

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: jian(dot)universality(at)gmail(dot)com
Cc: assam258(at)gmail(dot)com, 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
Subject: Re: Row pattern recognition
Date: 2026-06-14 07:19:24
Message-ID: 20260614.161924.1715049956147298411.ishii@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> get_windowclause_startup_tuples
> do we need some comments for WindowClause->defineClause

We already have comments for DEFINE clause. Do you think it's not enough?

* Moreover, if row pattern recognition is used, we charge the DEFINE
* expressions once per tuple for each variable that appears in PATTERN.

> src/backend/executor/README.rpr
> (2) Transcription to WindowClause
> - Copies rpPattern, rpSkipTo, initial fields
>
> In transformRPR, we did this:
> ``wc->rpPattern = windef->rpCommonSyntax->rpPattern;``
> Since this is an assignment, not a copy, is "Copies rpPattern" incorrect?

I think "Copies" is Ok here. Yes, we do not use copyObject to copy the
rpPattern object but copying just the pointer can be regarded as kind
of "copy".

> ISO reference typo: most occurrences use {ISO/IEC 19075},
> but rpr_integration.sql and some places reference 9075-2:2016 instead of 19075.
> We may need check all occurrences to ensure consistency.

19075 and 9075-2 are the different standard documents.

19075-5: Information technology ― Guidance for the use of database language SQL ― Part 5: Row pattern recognition
9075-2: Information technology ― Database languages ― SQL ― Part 2: Foundation (SQL/Foundation)

IMO they are used differently depending on the context.

> In struct ResultRelInfo, we have fields like {ri_CheckConstraintExprs,
> ri_WithCheckOptionExprs}.
> Similarly, I want to rename WindowAggState->defineClauseList to
> defineClauseExprs

Looks reasonable proposal to me.

> I think the comment on function contain_rpr_walker can be removed,
> since transformWithClause already explains it.

I don't think we want to remove all function comments of
contain_rpr_walker. However I am not against removing "Used by
transformWithClause() to enforce ISO/IEC 9075-2:2016 7.17 SR 3)f) on
WITH RECURSIVE elements." because it's somewhat redundant.

> Is "judgment" really the right word?
>
> I don't fully understand the purpose of eval_nav_offset_helper now.
> Also, the branch where (isnull == true) and (offset < 0) appears
> unreachable; it's never hit in the regression tests.
> We should add some regression tests for these scenarios.

Yeah. Maybe we can turn them into Assertions?

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2026-06-14 07:22:50 Re: postgres_fdw: possible overlooked NAMEDATALEN comparison in stats import
Previous Message cca5507 2026-06-14 07:12:43 Handle concurrent drop when doing whole database vacuum