Re: Why isn't DECLARE CURSOR ... FOR UPDATE supported?

From: Rod Taylor <pg(at)rbt(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why isn't DECLARE CURSOR ... FOR UPDATE supported?
Date: 2003-12-18 15:52:47
Message-ID: 1071762767.81635.13.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 2003-12-18 at 10:20, Tom Lane wrote:
> Is there any good reason for this restriction?
>
> regression=# begin;
> BEGIN
> regression=# declare c cursor for select * from tenk1 for update;
> ERROR: DECLARE CURSOR ... FOR UPDATE is not supported
> DETAIL: Cursors must be READ ONLY.
>
> While I have not tried it, I think that simply removing this error check
> in PerformCursorOpen() would allow the system to behave in a reasonable
> way, ie, locking each row the first time it is fetched through the
> cursor.

The help implies you can.

Command: DECLARE
Description: define a cursor
Syntax:
DECLARE name [ BINARY ] [ INSENSITIVE ] [ [ NO ] SCROLL ]
CURSOR [ { WITH | WITHOUT } HOLD ] FOR query
[ FOR { READ ONLY | UPDATE [ OF column [, ...] ] } ]

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sailesh Krishnamurthy 2003-12-18 16:11:58 Re: OLAP CUBE/ROLLUP Operators and GROUP BY grouping sets
Previous Message Doug McNaught 2003-12-18 15:32:04 Re: plpgsql Integer Concat To String