Expanding DELETE/UPDATE returning

From: Rusty Conover <rconover(at)infogears(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Expanding DELETE/UPDATE returning
Date: 2007-02-27 03:24:20
Message-ID: D1ABEDFA-66AB-49FD-BE78-4C25E52709ED@infogears.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-02-27 03:26:40 Re: autovacuum next steps, take 2
Previous Message John Bartlett 2007-02-27 03:23:17