Re: Row pattern recognition
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: Tatsuo Ishii <ishii@postgresql.org>
Cc: assam258@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-19T00:07:53Z
Lists: pgsql-hackers
On Thu, Jun 18, 2026 at 5:50 PM Tatsuo Ishii <ishii@postgresql.org> wrote:
>
> Hi Henson,
>
> > Hi Jian and Tatsuo,
> >
> > Thanks for the patch and the careful review.
> >
> > Tatsuo, item 1 below (attribute notation inside a DEFINE clause) is a
> > question for you; the rest is feedback on Jian's patch.
>
> > 1. Attribute notation inside a DEFINE clause, e.g. (f).prev.
> >
> > The guard this change removes is one I deliberately left undecided
> > during development (hence the XXX comment), so I'd keep it for now and
> > ask here. Without it, (f).prev with no such field gives a generic
> > "column \"prev\" not found ..." instead of the dedicated "cannot use
> > row pattern navigation function PREV in attribute notation". Three
> > options:
> >
> > (a) Treat (f).prev as an ordinary function (prev(f)), the same as
> > outside a DEFINE clause -- which is what the patch does.
> >
> > (b) Treat (f).prev as the navigation function -- read the attribute
> > notation as navigation. An ordinary function of that name is still
> > reachable as public.prev(...).
> >
> > (c) Reject the ambiguous (f).prev with a dedicated error (what is
> > currently committed), rather than resolving it one way or the
> > other.
> >
> > My own leaning is actually (a) -- it keeps attribute notation behaving
> > the same inside and outside a DEFINE clause. (c) is what's in the tree
> > now, and either way it changes the user-visible error and SQLSTATE, so
> > I'd rather settle this explicitly than let the refactor decide it
> > silently. Tatsuo, what do you think?
>
ParseFuncOrColumn cleanly handles (f).prev by translating it to prev(f) as a
regular function call. However, if a dedicated window navigation function
exists, this translation creates ambiguity — it becomes unclear whether prev(f)
is window navigation or a normal function call.
Cases with additional dots (e.g., public.prev(arg)) should also be
treated as normal
function calls, IMHO.
As a result, only prev(arg) and prev(arg, offset) are recognized as special
window navigation syntax, despite being visually identical to a function call.
Summary:
Dedicated window navigation functions should be removed entirely. Window
navigation should be limited to a single syntactic form (no dots) — one that
*looks* like a function call but is parsed as syntax.
This is not unprecedented; there are many existing cases where something appears
to be a function call but is actually a syntax form, for example:
SELECT json_object('{}');
json_object
-------------
{}
(1 row)
SELECT public.json_object('{}');
ERROR: function public.json_object(unknown) does not exist
LINE 1: SELECT public.json_object('{}');
^
So I think in the DEFINE context, it makes sense for some form that
looks like a function call to actually be syntax.
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