pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Spiegelberg, Greg <gspiegelberg@cranel.com>
Cc: Bruno Wolff III <bruno@wolff.to>
Cc: Ricardo Valença de Assis <valenca@campusvirtual.br>
Cc: pgsql-admin@postgresql.org
Subject: Re: delete to slow
Date: Sat, 23 Apr 2005 19:53:40 -0400
Message-ID: <23990.1114300420@sss.pgh.pa.us> (raw)
In-Reply-To: <82E74D266CB9B44390D3CCE44A781ED9070C90@POSTOFFICE.cranel.local>
References: <82E74D266CB9B44390D3CCE44A781ED9070C90@POSTOFFICE.cranel.local>

"Spiegelberg, Greg" <gspiegelberg@cranel.com> 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



view thread (18+ messages)

Message-ID: <23990.1114300420@sss.pgh.pa.us>
Permalink:  ../23990.1114300420@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23990.1114300420@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gspiegelberg@cranel.com, bruno@wolff.to, valenca@campusvirtual.br
  Subject: Re: delete to slow
  In-Reply-To: <23990.1114300420@sss.pgh.pa.us>
  References: <82E74D266CB9B44390D3CCE44A781ED9070C90@POSTOFFICE.cranel.local> <23990.1114300420@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox