JSqlParser
JSqlParser copied to clipboard
4.1 Parser fails on H2 Ordered Aggregate Functions
Just stumpled over this:
-- LISTAGG 3: fails to parse
SELECT LISTAGG(ID, ', ') WITHIN GROUP (ORDER BY ID) OVER (ORDER BY ID);
-- ARRAY_AGG 2: fails to deparse correctly
SELECT ARRAY_AGG(NAME ORDER BY ID) FILTER (WHERE NAME IS NOT NULL);
-- ARRAY_AGG 3 fails to deparse correctly
SELECT ARRAY_AGG(ID ORDER BY ID) OVER (ORDER BY ID);
net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "BY" "BY" at line 1, column 65.
I will look into this and try to craft a PR when I find some time.
The second and third SQL is now parsed and deparsed successfully.
To the first one: I was not aware that additional to this "within group" an over clause is valid.
Should be address by PR #1666.