For some reason we currently support sub-SELECT expressions only
in WHERE and HAVING clauses, not in the target list of a SELECT.
Does anyone know why this is?
There are a number of places in the planner/optimizer that would need
to be fixed to make it happen, but the changes are utterly trivial
(calling certain transformation routines on the targetlist as well as
for WHERE and HAVING ... probably about a dozen lines total ...).
And a quick look at the executor doesn't show any reason why it would
have a problem, either. Is there something fundamental that I'm
missing? If not, why wasn't this done to begin with?
regards, tom lane