"ORDER BY" clause prevents "UPDATE WHERE CURRENT OF"

From: "Robert Haas" <robertmhaas(at)gmail(dot)com>
To: Postgres <pgsql-hackers(at)postgresql(dot)org>
Subject: "ORDER BY" clause prevents "UPDATE WHERE CURRENT OF"
Date: 2008-11-14 21:32:28
Message-ID: 603c8f070811141332l3b8ebbc0vaf70219a27cc795@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I found the following behavior surprising. Is there a reason for it?
This is 8.3.5. ...Robert

rhaas=# BEGIN WORK;
BEGIN
rhaas=# CREATE TABLE test_table (id serial, foo integer, bar integer);
NOTICE: CREATE TABLE will create implicit sequence
"test_table_id_seq" for serial column "test_table.id"
CREATE TABLE
rhaas=# INSERT INTO test_table VALUES (DEFAULT, 1, 1);
INSERT 0 1
rhaas=# DECLARE c CURSOR FOR SELECT id FROM test_table ORDER BY foo FOR UPDATE;
DECLARE CURSOR
rhaas=# FETCH c;
id
----
1
(1 row)

rhaas=# UPDATE test_table SET bar = NULL WHERE CURRENT OF c;
ERROR: cursor "c" is not a simply updatable scan of table "test_table"
rhaas=# \q

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-11-14 21:38:11 Re: WIP: Column-level Privileges
Previous Message Heikki Linnakangas 2008-11-14 21:12:08 Re: Signal handling patch (v2) for Synch Rep