"Ansley, Michael" wrote:
>
> I thought that all correlated and uncorrelated sub-queries could be
> rewritten as a join, simplifying the query tree. It should be a mechanical
> process which can probably be performed in the rewriter.
IN can't be rewritten as a join! Subquery may return duplicates
and join would return tuple for all of them.
And how about WHERE x = (select max(y) from ...) ?
And even for WHERE x = (select y from ...) we have to check
that subquery returns exactly ONE row, or abort.
Vadim