"Spiegelberg, Greg" <[EMAIL PROTECTED]> writes:
> Would it be possible to perform a DELETE FROM table WHERE CURRENT OF mycursor?
> Is this implemented in Postgres?  I'm not seeing in in the manual for 7.4 or 
> 8.

It is (or at least ought to be) on the TODO list, but it's not done yet
and I don't think anyone's working on it.

A reasonably efficient way to fake it is to include CTID in the cursor
readout and issue a delete-by-ctid instead.

        DECLARE c CURSOR FOR SELECT ctid, ... FROM mytable WHERE ...;
        FETCH FROM c;
        DELETE FROM mytable WHERE ctid = 'whatever';

This is more or less what would have to happen behind the scenes for
WHERE CURRENT OF to be implemented.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to