Skip site navigation (1) Skip section navigation (2)

Re: BUG #5123: bug in window function "last_value"

From: David Fetter <david(at)fetter(dot)org>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Andrey <andrey(at)ulab(dot)ru>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5123: bug in window function "last_value"
Date: 2009-10-16 16:20:31
Message-ID: 20091016162031.GA3999@fetter.org (view raw or flat)
Thread:
Lists: pgsql-bugs
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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2009-10-16 16:37:20
Subject: Re: BUG #5121: Segmentation Fault when using pam w/ krb5
Previous:From: Douglas, RyanDate: 2009-10-16 16:19:51
Subject: Re: BUG #5121: Segmentation Fault when using pam w/ krb5

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group