Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

Next:From: Tom LaneDate: 2007-02-27 03:26:40
Subject: Re: autovacuum next steps, take 2
Previous:From: John BartlettDate: 2007-02-27 03:23:17
Subject:

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group