Using results from DELETE ... RETURNING

From: "Shak" <sshaikh(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Using results from DELETE ... RETURNING
Date: 2009-06-01 15:21:27
Message-ID: h00rnj$25j3$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hi all,

When RETURNING from a DELETE statement (or similar), how do you access the
results being returned?

Something like:

SELECT COUNT(*) FROM (DELETE FROM a RETURNING *) ;

sounds reasonable but results in a syntax error. I am able to return single
results into a variable or record, but not more than one result.

I could use a SELECT ... FOR UPDATE in the meantime (and then a DELETE), I
just wanted to know what the use of RETURNING * was if you can't do anything
with the results.

Thanks!

Shak

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2009-06-01 15:38:55 Re: ruby connect
Previous Message Shak 2009-06-01 15:18:36 Using results from RETURNING

Browse pgsql-hackers by date

  From Date Subject
Next Message Aidan Van Dyk 2009-06-01 15:27:36 Re: pg_standby -l might destory the archived file
Previous Message Tom Lane 2009-06-01 15:18:30 Re: pg_migrator and an 8.3-compatible tsvector data type