Re: Row pattern recognition

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Vik Fearing <vik(at)postgresfriends(dot)org>
Cc: Tatsuo Ishii <ishii(at)postgresql(dot)org>, jacob(dot)champion(at)enterprisedb(dot)com, pgsql-hackers(at)postgresql(dot)org, er(at)xs4all(dot)nl, peter(at)eisentraut(dot)org
Subject: Re: Row pattern recognition
Date: 2024-10-22 14:19:41
Message-ID: CAKFQuwZA4m5bEi+TQZ2RAM8eiHQViN0_KH5nnNqgtU7JMTjUBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 22, 2024 at 6:12 AM Vik Fearing <vik(at)postgresfriends(dot)org> wrote:

>
> On 22/10/2024 12:19, Tatsuo Ishii wrote:
>
> Acording to ISO/IEC 9075-2:2016 "4.21.2 Row pattern navigation operations",
>
> <row pattern navigation operation> evaluates a <value expression> VE
> in a row NR, which may be different than current row CR.
>
> From this I think PREV(col + 1) should be interpreted as:
>
> 1. go to the previous row.
> 2. evaluate "col + 1" at the current row (that was previous row).
> 3. return the result.
>
> If my understanding is correct, prev(price + 1) has the same meaning
> as prev(price) + 1.
>
>
>
> This is how I read the specification also.
>
>
>
That makes sense. Definitely much nicer to only have to write PREV once if
the expression you are evaluating involves multiple columns. And is also
consistent with window function "value" behavior.

Thanks!

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jehan-Guillaume de Rorthais 2024-10-22 14:23:12 Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails
Previous Message Melanie Plageman 2024-10-22 13:42:41 Re: Using read_stream in index vacuum