It's working for me using SQLFiddle, not sure why it would't work for you. But I do have an explanation as to why it might not be working for you and why the alternative would work...
Your example is using a keyword as a column name, that may not always work. But when the column is only in a sub expression, the query engine is free to discard the name (in fact it probaly does) so the fact that it potentially potentially conflicts with a key word may be disregarded.
EDIT: in response to your edit/comment. No, the two aren't equivalent. The RESULT would be equivalent, but the process of getting to that result is not at all similar. For the first to work, the parser has do some work that simply doesn't make sense for it to do (applying an aggregate to a single value, either on a row by row basis or as), in the second case, an aggregate is applied to a table. The fact that the table is a temporary virtual table will be unimportant to the aggregate function.
GROUP BY
) always returns exactly one row. Under what circumstances would it make sense to apply an aggregate to that one row? A vector aggregate returns one row per group. Whilst sometimes it might be useful to apply another aggregation to the result of that you would need a differentGROUP BY
applied for the two aggregates for this to be useful. – Beatnik<value expression>
simply contained in<set function specification>
shall not contain a<set function specification>
or a<subquery>
– Beatnikaggregate(aggregate(...))
is impossible because there's no way to specifyGROUP BY ... OVER (GROUP BY ...)
. I.e. if we wanted to nest aggregates, we should also be able to nest GROUP BYs, which we have not been allowed (yet?). You say there are no GROUP BYs in your examples? But there are, namelyGROUP BY ()
, which is always implied when not specified explicitly. – Lange