Skip to content

A Golang port of markdrago/pgsanity to run sanity checks on SQL scripts with focus on PostgreSQL syntax.

License

Notifications You must be signed in to change notification settings

erstam/go-pgsanity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-pgsanity

A Golang port of markdrago/pgsanity to run sanity checks on SQL scripts with focus on PostgreSQL syntax.

Under the hood, pgsanity uses ecpg.

ecpg is the embedded SQL preprocessor for C programs. It converts C programs with embedded SQL statements to normal C code by replacing the SQL invocations with special function calls. The output files can then be processed with any C compiler tool chain.

License

See LICENSE for details.

Installation

go get github.com/erstam/go-pgsanity/pgsanity

You can control where the executable gets installed using the %GOBIN% env var.

Note: Make sure that you have PostgreSQL installed and that the ecpg tool is in %PATH%. Check with where ecpg to confirm. You can install PostgreSQL here.

Usage

At the cmd prompt / linux shell:

> pgsanity <path_to_file_or_folder>
  • If a file path is provided, it must end with .sql.
  • If a folder path is provided, the folder is scanned for all .sql files, and those are processed, others are skipped.

Note: tested on Windows only!

Contribute

PRs are welcome! :)

About

A Golang port of markdrago/pgsanity to run sanity checks on SQL scripts with focus on PostgreSQL syntax.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages