nene / prettier-plugin-sql-cst

Prettier SQL plugin that uses sql-parser-cst
https://nene.github.io/prettier-sql-playground/
GNU General Public License v3.0
123 stars 7 forks source link

Add mariadb, mysql, postgresql parsers #14

Closed karlhorky closed 9 months ago

karlhorky commented 9 months ago

I saw that there was experimental support for the mariadb, mysql, postgresql parsers:

Not sure if this is the only change that's required or if some parsing / formatting things will break in CI / build / runtime

Or maybe there's no appetite for this change currently, while these other dialects are experimental still...?

nene commented 9 months ago

I've been reluctant on implementing the formatting before full parsing support is ready. There is likely a better middle-ground here, but for now I think the parsing of these three dialects is in way too early state.

Additionally simply dropping in the names of the dialects is only the tip of the iceberg. One needs to go through all additional AST nodes that are introduced by these dialects and implement formatting of them. Plus modify the existing formatting rules for nodes with new data.

Like (a contrived example) it might happen that the parser correctly parses CREATE TEMPORARY TABLE foo (); but the formatter outputs CREATE TABLE foo ();, because it doesn't know about the possibility of this TEMPORARY modifier.

karlhorky commented 9 months ago

Ok sounds good. I was thinking there may be more to it than just the 2 lines 👍