nene / sql-parser-cst

Parses SQL into Concrete Syntax Tree (CST)
GNU General Public License v2.0
115 stars 7 forks source link

Postgres Support #40

Open shishkin opened 1 year ago

shishkin commented 1 year ago

I'm looking forward to this project to support Postgres dialect, so it can unblock Postgres support in the prettier plugin.

Edit: I'm hijacking this issue to track the overall progress of PostgreSQL support:

karlhorky commented 6 months ago

Would also love to see PostgreSQL support here 🙌 @nene is this something on the mid-term roadmap?

nene commented 6 months ago

Well, it is sort of on the roadmap since starting working on this whole library. But Postgres being pretty big and complex, just the thought of the task ahead puts me off from starting to implement support for it.

karlhorky commented 6 months ago

Understood, thanks for the reply. Really appreciate the work that you're doing on both this project and sql-formatter.

I guess there's also not a way to build on existing parsers / existing schema data or use code generation somehow to reduce the implementation complexity here... 🤔

wolfgangwalther commented 2 months ago

To fully support postgres, it would be good to support psql meta commands (starting with \) and variables (with :), too.

nene commented 2 months ago

To fully support postgres, it would be good to support psql meta commands (starting with ) and variables (with :), too.

Yep. This is in the plans. But for now I'm concentrating on finishing the support for the actual SQL part.

Another thing to fully support Postgres is having support for PL/pgSQL.

I think both can be implemented as supersets of the base PostgreSQL grammar.