This is my test case (all in one session):
CREATE TABLE foo (
key int PRIMARY KEY,
value int
);
INSERT INTO foo VALUES (1, 1);
BEGIN;
DECLARE foo CURSOR FOR SELECT * FROM foo FOR UPDATE;
UPDATE foo SET value = 2 WHERE key = 1;
UPDATE foo SET value = 3 WHERE key = 1;
FETCH 1 FROM foo;
COMMIT;
I expected the FETCH to return one row, with the latest data, i.e.
(1, 3), but instead it's returning empty.
If instead I run both UPDATEs in another session, then I do get
alvherre=# FETCH 1 FROM foo;
key | value
-----+-------
1 | 3
(1 fila)
Is this intended?
--
Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>