Re: Subselects lack functionality

Lamar Owen <lamar.owen@wgcr.org>

From: Lamar Owen <lamar.owen@wgcr.org>
To: winnie@hoth.amu.edu.pl, pgsql-bugs@postgresql.org
Date: 2000-09-28T22:20:52Z
Lists: pgsql-bugs
pgsql-bugs@postgresql.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