Re: Row pattern recognition

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

I have created v50 RPR patches from patches (nocfbot-000*.txt and
nocfbot-100*.txt) attached to the following email:
https://www.postgresql.org/message-id/CAAAe_zDF-jqo=m+pcuPB1h_sG1t+nY08acjBEcfD=1KoQN4JOQ@mail.gmail.com

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.),
Empty pattern ("PATTERN ()") are not permitted by the standard
Anchors (^, $) are not permitted in R020 by the standard
- 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 -}
- PERMUTE
- CLASSIFIER

Author: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Author: Henson Choi <assam258(at)gmail(dot)com>
Reviewed-by: Vik Fearing <vik(at)postgresfriends(dot)org>
Reviewed-by: Jacob Champion <jchampion(at)timescale(dot)com>
Reviewed-by: Peter Eisentraut <peter(at)eisentraut(dot)org>
Reviewed-by: NINGWEI CHEN <chen(at)sraoss(dot)co(dot)jp>
Reviewed-by: "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: SungJun Jang <sjjang112233(at)gmail(dot)com>
Reviewed-by: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Reviewed-by: jian he <jian(dot)universality(at)gmail(dot)com>

Thanks to Jian He for an extensive review that helped surface several
defects and substantially improved the readability and maintainability
of the code; the review also prompted the redesign of the
window-navigation functions.

Discussion: https://postgr.es/m/20230625.210509.1276733411677577841.t-ishii%40sranhm.sra.co.jp

Major changes since v49 include:

- Placefolder functions for row pattern navigation operations (PREV,
NEXT, FIRST, and LAST) are no longer used. Parse/analysis turned
them into RPRNavExpr nodes. Now RPR patches do not include any
system catalog changes. Also no changes are made to windowfuncs.c as
it does not need to include placeholder functions for RPR's PREV
navigation operators.

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
v50-0001-Row-pattern-recognition-patch-for-raw-parser-v50.patch application/octet-stream 38.8 KB
v50-0002-Row-pattern-recognition-patch-parse-analysis.patch application/octet-stream 53.1 KB
v50-0003-Row-pattern-recognition-patch-rewriter.patch application/octet-stream 14.1 KB
v50-0004-Row-pattern-recognition-patch-planner.patch application/octet-stream 99.6 KB
v50-0005-Row-pattern-recognition-patch-executor-and-comma.patch application/octet-stream 168.8 KB
v50-0006-Row-pattern-recognition-patch-docs.patch application/octet-stream 88.1 KB
v50-0007-Row-pattern-recognition-patch-tests-SQL-data.patch application/octet-stream 577.7 KB
v50-0008-Row-pattern-recognition-patch-tests-expected.patch application/octet-stream 886.1 KB
v50-0009-Row-pattern-recognition-patch-typedefs.list.patch application/octet-stream 1.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-07-28 02:49:58 Re: NULL pointer dereference in syslogger with load_libraries() and -DEXEC_BACKEND at startup
Previous Message Tender Wang 2026-07-28 02:36:10 Re: Partition pruning can incorrectly exclude a RANGE default partition