Open roman-vanesyan opened 1 month ago
Thanks for reporting.
This is indeed a problem in the parser. Looks like I have skipped over this part of PostgreSQL documentation. Thanks for the link.
Apparently I have explicitly enabled the FILTER syntax only for SQLite. Should be a simple fix to right it.
Fixed the FILTER-issue. But there's more in this aggregate function syntax that I'm missing.
Will probably do a release with just that fix though.
Could you please cut the release as well?
@roman-vanesyan the release with this fix is now out and I've also released new version of the prettier plugin.
Hey! First of all, I'd like to thank you for your work. You're truly doing an awesome job!
Recently I've been dealing with Postgres aggregate expressions and https://github.com/nene/prettier-plugin-sql-cst is failing on formatting them. AFAIA, the prettier plugin is based on this parser. I tried to look across this repository's issues but seems like there is no tracking ticket for this functionality.
Here you can read about aggregate expressions https://www.postgresql.org/docs/16/sql-expressions.html#SYNTAX-AGGREGATES.
Here is an example of a query for which formatter is failing:
The stack trace:
Here are the dependencies versions:
Prettier config: