Re: Row pattern recognition

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: assam258(at)gmail(dot)com
Cc: 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-05-02 05:03:04
Message-ID: 20260502.140304.670813149418899420.ishii@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Attached is the v47 patches for Row pattern recognition (SQL/RPR).

Major changes from v46 include:

- Change implementation of row pattern navigation operations using
"1-slot model", which allows to implement more standard compliant
features such as an offset argument, more row pattern navigation
operations (FIRST, LAST) and compound forms.

- Row pattern navigation operations now support FIRST, LAST and
compound forms

- Add JIT compilation support for all row pattern navigation
operations (including compound forms)

- Add tuplestore trim optimization for RPR PREV navigation

- Window function last_value() now allows to set mark in certain cases

- Change the implementation of reduced frame map. Now consumes less CPU and memory

- Add more optimization (absorption). e.g. (A B B)+

- Add planner integration tests (rpr_integration.sql)

- Add src/backend/executor/README.rpr (previously was in ExecRPR.c)

Current status:

The series of patches are to implement the row pattern recognition
(SQL/RPR) feature. Currently the implementation is a subset of SQL/RPR
(ISO/IEC 19075-2:2016). Namely, implementation of some features of
R020 (WINDOW clause). R010 (MATCH_RECOGNIZE) is out of the scope of
the patches.

Currently following features are implemented in the patches.

- PATTERN
- PATTERN regular expressions (+, *, ?)
alternation (|), grouping () , {n}, {n,}, {n,m}, {,m}
reluctant quantifiers (*? etc.),
- DEFINE
- INITIAL
- AFTER MATCH SKIP TO PAST LAST ROW
- AFTER MATCH SKIP TO NEXT ROW
- Row pattern navigation (FIRST, LAST, PREV, NEXT and their compound forms)

Currently following features are not implemented in the patches.

- MEASURES
- Pattern variable name qualified column reference (e.g. A.price)
- SUBSET
- SEEK
- AFTER MATCH SKIP TO
- AFTER MATCH SKIP TO FIRST
- AFTER MATCH SKIP TO LAST
- PATTERN regular expression {- and -}, () (empty pattern)
Anchors (^, $) are not permitted with RPR in Window clause by the
standard.
- PERMUTE
- CLASSIFIER

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

Attachment Content-Type Size
v47-0001-Row-pattern-recognition-patch-for-raw-parser.patch application/octet-stream 32.0 KB
v47-0002-Row-pattern-recognition-patch-parse-analysis.patch application/octet-stream 42.5 KB
v47-0003-Row-pattern-recognition-patch-rewriter.patch application/octet-stream 8.1 KB
v47-0004-Row-pattern-recognition-patch-planner.patch application/octet-stream 93.3 KB
v47-0005-Row-pattern-recognition-patch-executor-and-comma.patch application/octet-stream 206.6 KB
v47-0006-Row-pattern-recognition-patch-docs.patch application/octet-stream 19.9 KB
v47-0007-Row-pattern-recognition-patch-tests-SQL-data.patch application/octet-stream 489.6 KB
v47-0008-Row-pattern-recognition-patch-tests-expected.patch application/octet-stream 737.0 KB
v47-0009-Row-pattern-recognition-patch-typedefs.list.patch application/octet-stream 1.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2026-05-02 09:10:02 Re: Proposal: Conflict log history table for Logical Replication
Previous Message Zhongpu Chen 2026-05-02 04:49:00 Re: Proposal: tighten validation for legacy EUC encodings or document that accepted byte sequences may be unconvertible to UTF8