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

From Andrey
Subject BUG #5123: bug in window function "last_value"
Date
Msg-id 200910160754.n9G7sdYx010385@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #5123: bug in window function "last_value"
List pgsql-bugs
The following bug has been logged online:

Bug reference:      5123
Logged by:          Andrey
Email address:      andrey@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

pgsql-bugs by date:

Previous
From: "Muris Pucic"
Date:
Subject: BUG #5122: Subqueries - inner select statement bug
Next
From: Robert Haas
Date:
Subject: Re: vacuumdb error