On Monday, October 21, 2024, Tatsuo Ishii <is...@postgresql.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.