The following bug has been logged online:

Bug reference:      5123
Logged by:          Andrey
Email address:      and...@ulab.ru
PostgreSQL version: 8.4.1-x86_64
Operating system:   RHEL5-x86_64
Description:        bug in window function "last_value"
Details: 

EXAMPLE:

CREATE TABLE t
(
  id serial NOT NULL,
  CONSTRAINT pkey_t PRIMARY KEY (id)
)
WITH (OIDS=FALSE);

INSERT INTO t VALUES(default);
INSERT INTO t VALUES(default);
INSERT INTO t VALUES(default);

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

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to