From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
Cc: | "jacob(dot)champion(at)enterprisedb(dot)com" <jacob(dot)champion(at)enterprisedb(dot)com>, "vik(at)postgresfriends(dot)org" <vik(at)postgresfriends(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "er(at)xs4all(dot)nl" <er(at)xs4all(dot)nl>, "peter(at)eisentraut(dot)org" <peter(at)eisentraut(dot)org> |
Subject: | Row pattern recognition |
Date: | 2024-10-22 05:29:34 |
Message-ID: | CAKFQuwatcdJaTz-TndQtc21JhgVzOCtZuatSAxD=cpnBLY1L+w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Monday, October 21, 2024, Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:
>
> I wonder how "PREV(col + 1)" is different from "PREV(col) + 1".
> Currently my RPR implementation does not allow PREV(col + 1). If
> "PREV(col + 1)" is different from "PREV(col) + 1", it maybe worthwhile
> to implement "PREV(col + 1)".
>
Interesting feature that I’m now just seeing.
The expression PREV(column_name) produces a value output taken from the
given named column in the preceding frame row. It doesn’t make any sense
to me to attempt to add the integer 1 to an identifier that is being used
as a value input to a “function”. It would also seem quite odd if “+ 1”
had something to do with row selection as opposed to simply being an
operator “+(column_name%type, integer)” expression.
Maybe RPR is defining something special here I haven't yet picked up on, in
which case just ignore this. But if I read: “UP as price > prev(price +
1)” in the opening example it would be quite non-intuitive to reason out
the meaning. “Price > prev(price) + 1” would mean my current row is at
least one (e.g. dollar per share) more than the value of the previous
period.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Andrey M. Borodin | 2024-10-22 06:29:48 | Re: Using read_stream in index vacuum |
Previous Message | Michael Paquier | 2024-10-22 05:09:03 | Re: Set query_id for query contained in utility statement |