libpg_query

C library for parsing PostgreSQL SQL outside the server

brewmacoslinux
Try with needOr install directly
Source

About

C library for accessing the PostgreSQL parser outside of the server environment

Commands

libpg_query

Examples

Parse a SQL statement and output its AST as JSON$ echo 'SELECT * FROM users WHERE id = 1;' | pg_query_parse
Validate SQL syntax for PostgreSQL compatibility$ pg_query_parse 'INSERT INTO table (col) VALUES (123);'
Fingerprint a SQL query to normalize it for caching$ pg_query_fingerprint 'SELECT * FROM users WHERE id = $1;'