package pg_query
Bindings to libpg_query for parsing PostgreSQL
Install
Dune Dependency
Authors
Maintainers
Sources
pg_query-0.9.8.tbz
sha256=b1d24219ccf7875d7921e81c21159589cade9775b871ab0e22959007820a8385
sha512=91f4dfae163c6c942c4e5294130751ff7c90ca50529bb9ff6e76b3694740d913a4e35007504682762c7d7178d8781e7ed3df0a625300855ab366d09ee847782f
Description
OCaml bindings to libpg_query for parsing PostgreSQL, and a command-line tool that uses them
Published: 21 Jan 2025
README
pg_query-ocaml
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"
Dependencies (6)
- ppx_deriving
-
ctypes-foreign
>= "0.21.1"
- ctypes
-
cmdliner
>= "1.1.0"
-
dune
>= "2.0"
-
ocaml
>= "4.07"
Dev Dependencies (1)
-
alcotest
with-test
Used by (1)
Conflicts
None
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page