On Fri, Oct 16, 2009 at 04:45:55PM +0300, Heikki Linnakangas wrote:
> 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?
I think what the OP was expecting was to have the last value be 3
instead of changing. This is at least a POLA violation.
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate