Re: Row pattern recognition
Tatsuo Ishii <ishii@postgresql.org>
From: Tatsuo Ishii <ishii@postgresql.org>
To: assam258@gmail.com
Cc: jacob.champion@enterprisedb.com, david.g.johnston@gmail.com,
vik@postgresfriends.org, er@xs4all.nl, peter@eisentraut.org,
pgsql-hackers@postgresql.org
Date: 2026-02-02T07:20:00Z
Lists: pgsql-hackers
Attachments
- v42-0001-Row-pattern-recognition-patch-for-raw-parser.patch (application/octet-stream) patch v42-0001
- v42-0002-Row-pattern-recognition-patch-parse-analysis.patch (application/octet-stream) patch v42-0002
- v42-0003-Row-pattern-recognition-patch-rewriter.patch (application/octet-stream) patch v42-0003
- v42-0004-Row-pattern-recognition-patch-planner.patch (application/octet-stream) patch v42-0004
- v42-0005-Row-pattern-recognition-patch-executor-and-comma.patch (application/octet-stream) patch v42-0005
- v42-0006-Row-pattern-recognition-patch-docs.patch (application/octet-stream) patch v42-0006
- v42-0007-Row-pattern-recognition-patch-tests.patch (application/octet-stream) patch v42-0007
- v42-0008-Row-pattern-recognition-patch-typedefs.list.patch (application/octet-stream) patch v42-0008
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.
Attached are the v42 patches.
The difference from v41 include:
- Add Peter as a reviewer to commit message. He gave a good valuable
suggestions to the gram.y patch. I accidentally forgot to credit his
name.
- Tons of enhancements from Henson.
-- Fully rewrite absorption logic (optimizer/plan/rpr.c).
Example: (a+ b* c?){2,} -> (a+" b* c?){2,}
-- Add safety check to tryMultiplyQuantifiers (optimizer/plan/rpr.c)
Example: (A{2}){2,3} cannot be rewritten to A{4,6} because it allows
5 times reputation which is not correct. Perform multiplication
optimization only in safe case.
-- Fix infinite loop/segfault when unlimited quantifiers (e.g. (A*)*,
(A+)+) are used.
-- Optimize unlimited quantifiers if possible (e.g. (A*)* -> A*, (A+)+ -> A+)
-- Fix segfault case (SELECT id, flag ...WINDOW w AS (... DEFINE T AS flag)
-- More accurate error position report
-- Some code refactoring in parser/planner patches
-- Split regression test file into rpr.sql and rpr_base.sql
-- Fix outfuncs.c and readfuncs.c
-- Fix some corner cases bug of regular expression optimization
-- Remove unused PATTERN variable to enhance performance
-- Change treatment of undefined DEFINE variables. Previously if
variable "A" is used in PATTERN but not defined in DEFINE, A is
automatically defined as "A AS TRUE". Now A is evaluated as TRUE in
executor and the generated entry for A is removed. This improves
memory usage.
-- EXPLAIN now shows the absorbable points (a+")
- Bug fix from me.
-- Assertion failure when two or more window clauses are used.
--
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 →
-
Adjust cross-version upgrade tests for seg_out() fix
- 3e3d7875e956 19 (unreleased) cited
-
Rationalize error comments in partition split/merge tests
- ecb2508aaf9b 19 (unreleased) cited
-
Add fast path for foreign key constraint checks
- 2da86c1ef9b5 19 (unreleased) cited
-
Fix assorted pretty-trivial memory leaks in the backend.
- e78d1d6d47dc 19 (unreleased) cited
-
Add temporal FOREIGN KEY contraints
- 89f908a6d0ac 18.0 cited
-
Add trailing commas to enum definitions
- 611806cd726f 17.0 cited
-
Remove obsolete executor cleanup code
- d060e921ea5a 17.0 cited