package pg_query

All checked builds pass
  1. Overview
  2. Docs
Bindings to libpg_query for parsing PostgreSQL

Install

dune-project
 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

Added to opam-repository:

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 (7)

  1. ppx_deriving
  2. ctypes-foreign >= "0.21.1"
  3. ctypes
  4. cmdliner >= "1.1.0"
  5. dune >= "2.0"
  6. ocaml < "5.0" & (arch = "x86_32" | arch = "arm32")
  7. ocaml >= "4.07"

Dev Dependencies (1)

  1. alcotest with-test

Optional Dependencies

None

Used by (1)

  1. ppx_rapper

Conflicts

None

Build status

Results of building pg_query with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.9.8 (this version) good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure