benbjohnson / postlite

Postgres wire compatible SQLite proxy.
Apache License 2.0
1.22k stars 31 forks source link

Consider using pg_query_go for AST parsing #3

Open kyleconroy opened 2 years ago

kyleconroy commented 2 years ago

👋

Really cool project! I'm not sure if you need to parse any of the incoming queries, but you can use the official PostgreSQL parser easily from Go: https://github.com/pganalyze/pg_query_go

I use this project to power PostgreSQL support in https://github.com/kyleconroy/sqlc

benbjohnson commented 2 years ago

hey! 👋

Thanks, I'm trying avoid parsing the Postgres queries too much. Most of the introspection queries are SET/SHOW which I ignore (😄) or they can be handled with the faked pg_catalog system in Postlite.

I do need to parse the CREATE TABLE queries in SQLite's sqlite_master table so I can provide introspection into the schema. I haven't dug into that too deep yet though.