X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2250F537A0 for ; Sat, 23 Apr 2005 20:53:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26215-01 for ; Sat, 23 Apr 2005 23:53:39 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 87F7F5379A for ; Sat, 23 Apr 2005 20:53:39 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3NNrehg023991; Sat, 23 Apr 2005 19:53:40 -0400 (EDT) To: "Spiegelberg, Greg" Cc: "Bruno Wolff III" , =?iso-8859-1?Q?Ricardo_Valen=E7a_de_Assis?= , pgsql-admin@postgresql.org Subject: Re: delete to slow In-reply-to: <82E74D266CB9B44390D3CCE44A781ED9070C90@POSTOFFICE.cranel.local> References: <82E74D266CB9B44390D3CCE44A781ED9070C90@POSTOFFICE.cranel.local> Comments: In-reply-to "Spiegelberg, Greg" message dated "Thu, 21 Apr 2005 09:09:06 -0400" Date: Sat, 23 Apr 2005 19:53:40 -0400 Message-ID: <23990.1114300420@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/349 X-Sequence-Number: 17362 "Spiegelberg, Greg" 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