sql-psi icon indicating copy to clipboard operation
sql-psi copied to clipboard

Percentile queries in Postgres. (WITHIN GROUP (ORDER BY myTable.myColumn))

Open Michael-Nolan opened this issue 3 years ago • 0 comments

Dialect

PostgreSQL

Failing SQL

SELECT percentile_disc(.5) WITHIN GROUP (ORDER BY myTable.myColumn) as P5
FROM myTable

Description

BY expected, got '('

Versions: sqldelight = "1.5.3" sqlpsi = "0.3.15"

It appears that SqlDelight is expecting the keyword BY to always come after the keyword GROUP. Link to Postgres docs - https://www.postgresql.org/docs/9.4/functions-aggregate.html

Michael-Nolan avatar Feb 07 '22 22:02 Michael-Nolan