RE: Updating cursors - Mailing list pgsql-general

From Hiroshi Inoue
Subject RE: Updating cursors
Date
Msg-id 000801c01650$2a152f00$2801007e@tpf.co.jp
Whole thread Raw
In response to Updating cursors  ("Jarmo Paavilainen" <netletter@comder.com>)
List pgsql-general
> -----Original Message-----
> From: Jarmo Paavilainen
>
> Hi,
>
> Ive a SELECT cursor which I want to update/delete but postgresql does not
> support these:
>
> UPDATE myTable SET myColumn = 'myValue' WHERE CURRENT OF myCursor
> DELETE myTable WHERE CURRENT OF myCursor
>
> Does there exist any workaround?
> Or is my syntax wrong?
>
> One workaround would be to get the row id and to be able to update it.
> Something like this:
>
> ... a row is selected and fetched ...
>

You may be able to use CTID.
You could get CTIDs by using SELECT statements like
    select CTID,* from myTable;
and update using CTID
     update myTable set ..=.. where CTID=..;

Note that CTIDs aren't of int type.

Regards.

Hiroshi Inoue

pgsql-general by date:

Previous
From: "Jarmo Paavilainen"
Date:
Subject: Updating cursors
Next
From: "Hiroshi Inoue"
Date:
Subject: RE: subselect in CHECK constraint?