Expanding DELETE/UPDATE returning
Rusty Conover <rconover@infogears.com>
From: Rusty Conover <rconover@infogears.com>
To: pgsql-hackers@postgresql.org
Date: 2007-02-27T03:24:20Z
Lists: pgsql-hackers
Hi, I didn't see this on the TODO list, but if it is my apologies. Is it in the cards to expand the functionality of DELETE/UPDATE returning to be able to sort the output of the rows returned? Or allow delete and update to be used in sub-queries? Some examples: create temp table t1 (id integer, location_id integer); insert into t1 values(1, 1); insert into t1 values(2, 1); insert into t1 values(3, 1); insert into t1 values(1, 3); create temp table search_requests (id integer); insert into search_requests values(1); insert into search_requests values(3); -- This works delete from search_requests using t1 where t1.id = search_requests.id returning t1.id, t1.location_id; -- This does not work. delete from search_requests using t1 where t1.id = search_requests.id returning t1.id, t1.location_id order by t1.location_id desc; -- This does not work. select foo.id, count(*) from (delete from search_requests using t1 where t1.id = search_requests.id returning t1.id, t1.location_id) as foo group by foo.id; Thanks, Rusty -- Rusty Conover InfoGears Inc. Web: http://www.infogears.com