Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

psql check if sql script is valid

$ pgsanity good1.sql good2.sql bad.sql
bad.sql: line 1: ERROR: syntax error at or near "bogus_token"

$ find -name '*.sql' | xargs pgsanity
./sql/bad1.sql: line 59: ERROR: syntax error at or near ";"
./sql/bad2.sql: line 41: ERROR: syntax error at or near "insert"
./sql/bad3.sql: line 57: ERROR: syntax error at or near "update"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #psql #check #sql #script #valid
ADD COMMENT
Topic
Name
2+9 =