Re: Row pattern recognition - Mailing list pgsql-hackers

From jian he
Subject Re: Row pattern recognition
Date
Msg-id CACJufxFWHp9Nb9CuLoHOGMVmV78cZeHk5piAyDFON3sr-XMQvQ@mail.gmail.com
Whole thread
In response to Re: Row pattern recognition  (Henson Choi <assam258@gmail.com>)
List pgsql-hackers
On Tue, Oct 6, 2026 at 11:25 AM Henson Choi <assam258@gmail.com> wrote:
>
> Thank you for the v54-0001 refactoring.
>
> Worse: when a navigation call is inside an offset.  A navigation call
> in the offset position is already the mistake; what is inside it is
> secondary.  Before, the caret was on that call.  Now the inner call is
> checked first, so the error is about its argument and the caret is on
> that argument.  The message no longer says that the offset cannot
> contain a navigation operation; when the inner call has no column
> reference it asks for one, and adding one only leads to the run-time
> constant error.
>
>   Before:
>     ERROR:  row pattern navigation offset cannot contain a row pattern navigation operation
>     LINE 6:     DEFINE A AS PREV(val, FIRST(1)) > 0)
>                                       ^
>   After:
>     ERROR:  argument of row pattern navigation operation must include at least one column reference
>     LINE 6:     DEFINE A AS PREV(val, FIRST(1)) > 0)
>                                             ^

There is a different way to intrepert this.
If we first process FIRST, the error message saying
ERROR:  argument of row pattern navigation operation must include at
least one column reference

If we first process PREV, then
ERROR:  row pattern navigation offset cannot contain a row pattern
navigation operation

My patch uses a bottom-up approach.
DEFINE A AS PREV(val, FIRST(1)) > 0)
first process expression (FIRST(1))

Different ways of processing the navigation yield different error
messages, and therefore the error position also differs.
So i think this should be ok.



pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: pg_resetwal: add --cluster-state option
Next
From: wenhui qiu
Date:
Subject: Re: "failed to build any N-way joins" from a five-relation query