Tom Lane wrote:
> Specifically, I'm imagining that we could convert
>
> SELECT min(x), max(y) FROM tab WHERE ...
>
> into sub-selects in a one-row outer query:
>
> SELECT (SELECT x FROM tab WHERE ... ORDER BY x LIMIT 1),
> (SELECT y FROM tab WHERE ... ORDER BY y DESC LIMIT 1);
Does this transformation work for a query of the form:
SELECT min(x), max(y) FROM tab WHERE random() > 0.5;
(which isn't a very useful query, but I'm sure you can imagine a more
realistic example involving volatile functions in the WHERE clause.)
-Neil