wieck@debis.com (Jan Wieck) writes:
> Tom Lane wrote:
>>>> - Could a subquery be included in the target list of a query
>>>> select a,(select b from c) from d where e = f;
>> [ is done ]
> Uh,
> who did the latter one?
Me.
> Just running some qry through psql I see that it works
> partially. Especially I see a
> ExecSetParamPlan: more than one tuple returned by expression subselect
Yes. I allowed the existing kinds of subselect expressions in
targetlists (not only in qual clauses), and fixed things so that
a subselect yielding a single result can appear anywhere in an
expression, not only as the righthand-side argument of an operator.
Subselects yielding multiple rows are still valid only as the
righthand argument of an IN, quantified boolean operator
(such as = ANY or = ALL), or EXISTS. It's a perfectly straightforward
generalization (and simplification!) of what we already had.
> So I assume it's not implemented in the form I outlined - the
> subselecting range table entry. I'll take a look at it the
> next days and maybe complain about that change if it
> interferes with the needs of the rule system to make
> aggregate, distinct, group by, sort by and all the other
> (long wanted) view stuff possible.
I don't believe this has anything to do with subselects as range
table entries. That facility will be quite separate from subselects
in expressions, no?
regards, tom lane