Re: BUG #5123: bug in window function "last_value" - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #5123: bug in window function "last_value"
Date
Msg-id 5398.1255701328@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #5123: bug in window function "last_value"  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: BUG #5123: bug in window function "last_value"
List pgsql-bugs
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> Andrey wrote:
>> select id, first_value(id) over(order by id), last_value(id) over(order by
>> id) from t;
>>
>> RESULT:
>> id | first_value | last_value
>> ----+-------------+------------
>> 1 |           1 |          1
>> 2 |           1 |          2
>> 3 |           1 |          3
>> (3 rows)
>>
>> fist_value - good, last_value - bad

> Looks ok to me. What did you expect?

These *are* the correct answers, since the default window frame runs
from first row to current row.  If you don't like them, you may need
to specify a different window frame.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #5122: Subqueries - inner select statement bug
Next
From: Hitoshi Harada
Date:
Subject: Re: BUG #5123: bug in window function "last_value"