Re: Subselects lack functionality - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Subselects lack functionality
Date
Msg-id 15854.970200693@sss.pgh.pa.us
Whole thread Raw
In response to Subselects lack functionality  (pgsql-bugs@postgresql.org)
List pgsql-bugs
pgsql-bugs@postgresql.org writes:
> Subselects don't allow one to use tuple set operators like UNION,
> INTERSECT, EXCEPT.

Yeah, we know.  The existing implementation of UNION etc. is a horrid
kluge that only works at the top level of a SELECT (and not even very
well there).  Fixing this will require a redesign of querytrees, which
is currently planned for 7.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.

As Lamar pointed out, this works now.

> Subselects cannot be used as arguments to aggregation functions

You have that backwards.  You don't do the select as an argument to
the aggregate, you use it as a context for the aggregate, eg

     ... (SELECT max(foo) FROM bar WHERE baz) ...

            regards, tom lane

pgsql-bugs by date:

Previous
From: Lamar Owen
Date:
Subject: Re: Subselects lack functionality
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: /contrib/soundex doesn't work. Version 7.0.2