Check syntax of sql for PostgreSQL
PgSanity checks the syntax of Postgresql SQL files.
It does this by leveraging the ecpg command which is traditionally used for preparing C files with embedded sql for compilation. However, as part of that preparation, ecpg checks the embedded SQL statements for syntax errors using the exact same parser that is in PostgreSQL.
So the approach that PgSanity takes is to take a file that has a list of bare SQL in it, make that file look like a C file with embedded SQL, run it through ecpg and let ecpg report on the syntax errors of the SQL.