postguard icon indicating copy to clipboard operation
postguard copied to clipboard

Questions? Feedback?

Open andywer opened this issue 6 years ago β€’ 11 comments

Add your feedback as a comment to this issue πŸ“‹

andywer avatar Dec 18 '18 14:12 andywer

Just wanted to say that this looks awesome. Not sure we will use it given its early stage though.

jtremback avatar Feb 26 '19 02:02 jtremback

Hi, this project looks amazing. Is it possible to use this for validating plain SQL and not postgres sql?

hassanNS avatar Nov 26 '19 22:11 hassanNS

Is it possible to use this for validating plain SQL and not postgres sql?

Since Postgres' SQL dialect is just a superset of "vanilla" SQL, there should be no problem validating that πŸ‘

I guess the only risk would be to use something too fancy that postgres/postguard understand and accept, but your non-postgres database (sqlite for instance) does not.

andywer avatar Nov 27 '19 08:11 andywer

This looks super cool. The thing that would make it perfect, from my point of view, would be if you could point it at an actual postgres schema definition (i.e. a directory containing .sql files) as the source of truth for the database, rather than defining it with defineTable. How much of a leap would that be?

gregplaysguitar avatar Jan 13 '20 02:01 gregplaysguitar

@gregplaysguitar Yeah, that would be great! Shouldn't be too hard either, now as I think about it…

Just not sure if I will have time to work on it anytime soon. I've been sick for the last week and a half and stuff is already piling up πŸ˜‰

andywer avatar Jan 17 '20 09:01 andywer

@andywer do you have any pointers as to where to start with that? I'd love to help out, although I don't have much free time either...

gregplaysguitar avatar Jan 18 '20 09:01 gregplaysguitar

@gregplaysguitar You can have a look at:

I think the best way to get started with the pg-query-parser package is to write a tiny test script that parses a simple SQL query and prints the parsed AST. Then play around with the input query a little bit and check out the resulting output.

andywer avatar Jan 18 '20 14:01 andywer

Great, thanks! I’ve been wanting to dig into pg query parsing for another project too so keen to have a look at this. I’ll let you know how I go!

gregplaysguitar avatar Jan 18 '20 19:01 gregplaysguitar

Can it validate queries at runtime? @andywer

LifeIsStrange avatar May 10 '22 16:05 LifeIsStrange

No, it's build-time-only πŸ˜‰ @LifeIsStrange

andywer avatar May 11 '22 12:05 andywer

that's unfortunate :) I have a use case where users write SQL queries on a web frontend and it would be nice to check the syntax validity on the client instead of doing roundtrips to the server. The only solution I've found is https://github.com/paxdei/GWTJSqlParser but it is a bit obscure haha

LifeIsStrange avatar May 11 '22 15:05 LifeIsStrange