| From: | Joshua Tolley <eggyknap(at)gmail(dot)com> |
|---|---|
| To: | Shak <sshaikh(at)hotmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Using results from DELETE ... RETURNING |
| Date: | 2009-06-05 21:45:33 |
| Message-ID: | 20090605214533.GB442@eddie |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general pgsql-hackers |
On Mon, Jun 01, 2009 at 04:21:27PM +0100, Shak wrote:
> 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.
You can't. It's on the TODO list (http://wiki.postgresql.org/wiki/Todo) Look
for "Allow INSERT/UPDATE ... RETURNING" and "Allow INSERT ... DELETE ... RETURNING"
- Josh / eggyknap
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2009-06-05 22:51:53 | Re: Using results from DELETE ... RETURNING |
| Previous Message | Tom Lane | 2009-06-05 21:35:19 | Re: why dropping a trigger may cause a deadlock |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dimitri Fontaine | 2009-06-05 22:11:24 | Re: pg_migrator issue with contrib |
| Previous Message | Tom Lane | 2009-06-05 21:41:27 | Re: blocking referencing system catalogs in 8.4 breaks my code |