pg_query

Bindings to libpg_query for parsing PostgreSQL
README

Bindings for pg_query for parsing PostgreSQL. Documentation is
here.

Usage

This provides a library that can be used in OCaml code like so:

let statement = "SELECT user, email FROM users WHERE id = 7"

let () =
  match Pg_query.parse statement with
  | Ok parse_tree -> use parse_tree
  | Error error_message -> use error_message

and a command-line utility:

$ echo "SELECT * FROM users" >> good.sql
$ echo "SELECT * FFROM users" >> bad.sql
$ pg_check good.sql bad.sql
[{"RawStmt": {"stmt": {"SelectStmt": {"targetList": [{"ResTarget": {"val": {"ColumnRef": {"fields": [{"A_Star": {}}], "location": 7}}, "location": 7}}], "fromClause": [{"RangeVar": {"relname": "users", "inh": true, "relpersistence": "p", "location": 14}}], "op": 0}}}}]
syntax error at or near "FFROM"
Install
Published
12 May 2021
Sources
0.9.7.tar.gz
md5=0f60f8c91c556be3f3a7e8f3f8305bb2
sha512=0efa2224ef75f1cea12437673da677964de0d56616e2166e2a794d6f6fd431b44dade1e18455cfeeab12576265f189030df4cd614f764970113476fc036633d2
Dependencies
alcotest
with-test
ctypes
>= "0.14.0"
cmdliner
>= "1.0.0"
dune
>= "2.0"
ocaml
>= "4.07"
Reverse Dependencies