I want to verify the syntax of files containing sql queries before they can be committed in my CVS project.
In order to do that, I have a commitinfo script, but I have trouble finding out if the sql commands are valid. psql
does not seem to have a dryrun mode, and constructing my own postgresql-dialact tester from the grammar (that is in the source) seems like a long stretch.
The scripts may contain multiple queries, so an EXPLAIN
cannot be wrapped around them.
Any hints?
plpgsql lint
that addresses exactly this shortcomming. Pavel Stěhule is the main developer. See this blog post. – Zoroaster