Hello!
This topic is based on the relevant SO question: https://stackoverflow.com/q/48869357/1220930
In short, the following query fails with strange error message:
SELECT * FROM (
SELECT
DATEDIFF('year', event_timestamp, NOW())
FROM
events
GROUP BY CUBE(
DATEDIFF('year', event_timestamp, NOW())
)
HAVING GROUPING(
DATEDIFF('year', event_timestamp, NOW())
) = 0
) AS subqueries GROUP BY 1;
[42803][7182] [Vertica]VJDBC ERROR: Grouping function arguments need to be group by expressions
But argument of the GROUPING is same with GROUP BY and NOW() is stable function. Solution is to wrap the NOW() in the extra subquery. More details are in linked SO topic (should i copy it here?). The solution works, but looks like a bug workaround, so I just want to report and clarify it.