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

Re: Subselects lack functionality

From: Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>
To: winnie(at)hoth(dot)amu(dot)edu(dot)pl, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Subselects lack functionality
Date: 2000-09-28 22:20:52
Message-ID: 39D3C444.B7BFEF66@wgcr.org (view raw or flat)
Thread:
Lists: pgsql-bugs
pgsql-bugs(at)postgresql(dot)org wrote:
> 2.
> It would be gr8 if single column subselects would allow themselves to be treated the same way as lists do as right-side arguments of IN operator.
> This would allow e.g. much more powerful DELETE statement, like
> DELETE FROM table WHERE id IN (SELECT ...)

This, AFAIK, works.  I am using just that construct in UPDATE -- I would
assume DELETE would work... 

Lessee...This works, as I just tested it on a client's database (inside
a transaction, with a rollback at the end, of course).  You say
something like

DELETE from users WHERE uid IN (SELECT uid FROM users WHERE username ~*
'testing') 

to delete (of course, I know that that is a contrived example, but a
working one).  

More complex is 

DELETE from personal_data WHERE uid IN (SELECT uid FROM users WHERE
username ~* 'testing') 

-- which works just fine on a client's database (again, inside a
transaction so I could easily roll back the delete :-)).

--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2000-09-29 04:11:33
Subject: Re: Subselects lack functionality
Previous:From: pgsql-bugsDate: 2000-09-28 22:01:38
Subject: Subselects lack functionality

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