3 ms·
Your suggestion is incorrect. CUBE is not part of the expression.
by remram 4y ago
Your suggestion is incorrect. CUBE is not part of the expression.
- OJFord 4y agoWell, I did say I wasn't familiar with it, but it's correct for `coalesce` and I don't think `cube` is different: https://www.postgresql.org/docs/current/cube.html https://www.postgresql.org/docs/current/cube.html In the context of `group by` it's treated as grouping sets, but that's not its only use. (Though that does seem to be special cased in terms of parsing, since afaict - I can't find the full query BNF on mobile - `grouping sets` is not optional.)
- remram 4y agohttps://www.postgresql.org/docs/14/sql-select.html https://www.postgresql.org/docs/14/sql-select.html GROUP BY [ ALL | DISTINCT ] grouping_element [, ...] grouping_element can be one of: ( ) expression ( expression [, ...] ) ROLLUP ( { expression | ( expression [, ...] ) } [, ...] ) CUBE ( { expression | ( expression [, ...] ) } [, ...] ) GROUPING SETS ( grouping_element [, ...] ) You're right about COALESCE of course.