markdrago / pgsanity

Check syntax of postgresql sql files
MIT License
316 stars 28 forks source link

Add "add-semicolon" flag to allow a missing final semicolon #16

Closed waisbrot closed 8 years ago

waisbrot commented 8 years ago

My SQL files are all used as input to programmatic SQL. When you use most (all?) PG client libraries, you don't need to provide the semicolon because the interface only allows you to send a single statement. Similarly, psql -c 'select a from b' works. In these cases, I don't want an error about a missing semicolon at the end.

This PR adds a --add-semicolon flag. When it's passed

I wrote some tests for the new behavior (which is pretty simple, I think). I'd be happy to make other modifications or add more tests if you'd like.