order by in cursor declaration does not allow update

From: "Dharmendra Goyal" <dharmendra(dot)goyal(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: order by in cursor declaration does not allow update
Date: 2007-10-25 06:58:36
Message-ID: f87e6d710710242358mb97b12bu45c70d35681b6500@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

If a cursor is declared using "Order by" then it gives following error
during updation of the cursor:
ERROR: cursor "c" is not a simply updatable scan of table "test"
Ex:
DROP TABLE IF EXISTS test;
create table test (num int,num2 int );
insert into test values(1,100);
insert into test values(2,200);
insert into test values(3,300);
insert into test values(4,400);
insert into test values(5,500);
BEGIN;
DECLARE c CURSOR FOR SELECT * FROM test ORDER BY num;
FETCH 2 FROM c;
UPDATE test SET num = 500 WHERE CURRENT OF c;
ERROR: cursor "c" is not a simply updatable scan of table "test"
SELECT * FROM test;
FETCH 2 FROM c;
COMMIT;
SELECT * FROM test;
FETCH 2 FROM c;
COMMIT;

Comments for this...??

Regards,
Dharmendra
www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2007-10-25 08:47:00 Re: pgadmin debug on windows
Previous Message kris.shannon 2007-10-25 06:28:51 Re: Feature Freeze date for 8.4