pg_grammar_guard
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_grammar_guard | 0.4.1 | RAG | PostgreSQL | SQL |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 1890 | pg_grammar_guard | No | No | No | Yes | No | No | grammar_guard |
| Related | pg_living_assertions |
|---|
Requires pg_living_assertions, despite older README text claiming no dependencies.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.4.1 | 1817161514 | pg_grammar_guard | pg_living_assertions |
| RPM | PIGSTY | 0.4.1 | 1817161514 | pg_grammar_guard_$v | pg_living_assertions_$v |
| DEB | PIGSTY | 0.4.1 | 1817161514 | postgresql-$v-pg-grammar-guard | postgresql-$v-pg-living-assertions |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.4.1 el8.x86_64.pg18 : pg_grammar_guard_18 pg_grammar_guard_18-0.4.1-1PGSTY.el8.noarch.rpm
| PIGSTY 0.4.1 el8.x86_64.pg17 : pg_grammar_guard_17 pg_grammar_guard_17-0.4.1-1PGSTY.el8.noarch.rpm
| PIGSTY 0.4.1 el8.x86_64.pg16 : pg_grammar_guard_16 pg_grammar_guard_16-0.4.1-1PGSTY.el8.noarch.rpm
| PIGSTY 0.4.1 el8.x86_64.pg15 : pg_grammar_guard_15 pg_grammar_guard_15-0.4.1-1PGSTY.el8.noarch.rpm
| PIGSTY 0.4.1 el8.x86_64.pg14 : pg_grammar_guard_14 pg_grammar_guard_14-0.4.1-1PGSTY.el8.noarch.rpm
|
| el8.aarch64 | PIGSTY 0.4.1 el8.aarch64.pg18 : pg_grammar_guard_18 pg_grammar_guard_18-0.4.1-1PGSTY.el8.noarch.rpm
| PIGSTY 0.4.1 el8.aarch64.pg17 : pg_grammar_guard_17 pg_grammar_guard_17-0.4.1-1PGSTY.el8.noarch.rpm
| PIGSTY 0.4.1 el8.aarch64.pg16 : pg_grammar_guard_16 pg_grammar_guard_16-0.4.1-1PGSTY.el8.noarch.rpm
| PIGSTY 0.4.1 el8.aarch64.pg15 : pg_grammar_guard_15 pg_grammar_guard_15-0.4.1-1PGSTY.el8.noarch.rpm
| PIGSTY 0.4.1 el8.aarch64.pg14 : pg_grammar_guard_14 pg_grammar_guard_14-0.4.1-1PGSTY.el8.noarch.rpm
|
| el9.x86_64 | PIGSTY 0.4.1 el9.x86_64.pg18 : pg_grammar_guard_18 pg_grammar_guard_18-0.4.1-1PGSTY.el9.noarch.rpm
| PIGSTY 0.4.1 el9.x86_64.pg17 : pg_grammar_guard_17 pg_grammar_guard_17-0.4.1-1PGSTY.el9.noarch.rpm
| PIGSTY 0.4.1 el9.x86_64.pg16 : pg_grammar_guard_16 pg_grammar_guard_16-0.4.1-1PGSTY.el9.noarch.rpm
| PIGSTY 0.4.1 el9.x86_64.pg15 : pg_grammar_guard_15 pg_grammar_guard_15-0.4.1-1PGSTY.el9.noarch.rpm
| PIGSTY 0.4.1 el9.x86_64.pg14 : pg_grammar_guard_14 pg_grammar_guard_14-0.4.1-1PGSTY.el9.noarch.rpm
|
| el9.aarch64 | PIGSTY 0.4.1 el9.aarch64.pg18 : pg_grammar_guard_18 pg_grammar_guard_18-0.4.1-1PGSTY.el9.noarch.rpm
| PIGSTY 0.4.1 el9.aarch64.pg17 : pg_grammar_guard_17 pg_grammar_guard_17-0.4.1-1PGSTY.el9.noarch.rpm
| PIGSTY 0.4.1 el9.aarch64.pg16 : pg_grammar_guard_16 pg_grammar_guard_16-0.4.1-1PGSTY.el9.noarch.rpm
| PIGSTY 0.4.1 el9.aarch64.pg15 : pg_grammar_guard_15 pg_grammar_guard_15-0.4.1-1PGSTY.el9.noarch.rpm
| PIGSTY 0.4.1 el9.aarch64.pg14 : pg_grammar_guard_14 pg_grammar_guard_14-0.4.1-1PGSTY.el9.noarch.rpm
|
| el10.x86_64 | PIGSTY 0.4.1 el10.x86_64.pg18 : pg_grammar_guard_18 pg_grammar_guard_18-0.4.1-1PGSTY.el10.noarch.rpm
| PIGSTY 0.4.1 el10.x86_64.pg17 : pg_grammar_guard_17 pg_grammar_guard_17-0.4.1-1PGSTY.el10.noarch.rpm
| PIGSTY 0.4.1 el10.x86_64.pg16 : pg_grammar_guard_16 pg_grammar_guard_16-0.4.1-1PGSTY.el10.noarch.rpm
| PIGSTY 0.4.1 el10.x86_64.pg15 : pg_grammar_guard_15 pg_grammar_guard_15-0.4.1-1PGSTY.el10.noarch.rpm
| PIGSTY 0.4.1 el10.x86_64.pg14 : pg_grammar_guard_14 pg_grammar_guard_14-0.4.1-1PGSTY.el10.noarch.rpm
|
| el10.aarch64 | PIGSTY 0.4.1 el10.aarch64.pg18 : pg_grammar_guard_18 pg_grammar_guard_18-0.4.1-1PGSTY.el10.noarch.rpm
| PIGSTY 0.4.1 el10.aarch64.pg17 : pg_grammar_guard_17 pg_grammar_guard_17-0.4.1-1PGSTY.el10.noarch.rpm
| PIGSTY 0.4.1 el10.aarch64.pg16 : pg_grammar_guard_16 pg_grammar_guard_16-0.4.1-1PGSTY.el10.noarch.rpm
| PIGSTY 0.4.1 el10.aarch64.pg15 : pg_grammar_guard_15 pg_grammar_guard_15-0.4.1-1PGSTY.el10.noarch.rpm
| PIGSTY 0.4.1 el10.aarch64.pg14 : pg_grammar_guard_14 pg_grammar_guard_14-0.4.1-1PGSTY.el10.noarch.rpm
|
| d12.x86_64 | PIGSTY 0.4.1 d12.x86_64.pg18 : postgresql-18-pg-grammar-guard postgresql-18-pg-grammar-guard_0.4.1-1PGSTY~bookworm_all.deb
| PIGSTY 0.4.1 d12.x86_64.pg17 : postgresql-17-pg-grammar-guard postgresql-17-pg-grammar-guard_0.4.1-1PGSTY~bookworm_all.deb
| PIGSTY 0.4.1 d12.x86_64.pg16 : postgresql-16-pg-grammar-guard postgresql-16-pg-grammar-guard_0.4.1-1PGSTY~bookworm_all.deb
| PIGSTY 0.4.1 d12.x86_64.pg15 : postgresql-15-pg-grammar-guard postgresql-15-pg-grammar-guard_0.4.1-1PGSTY~bookworm_all.deb
| PIGSTY 0.4.1 d12.x86_64.pg14 : postgresql-14-pg-grammar-guard postgresql-14-pg-grammar-guard_0.4.1-1PGSTY~bookworm_all.deb
|
| d12.aarch64 | PIGSTY 0.4.1 d12.aarch64.pg18 : postgresql-18-pg-grammar-guard postgresql-18-pg-grammar-guard_0.4.1-1PGSTY~bookworm_all.deb
| PIGSTY 0.4.1 d12.aarch64.pg17 : postgresql-17-pg-grammar-guard postgresql-17-pg-grammar-guard_0.4.1-1PGSTY~bookworm_all.deb
| PIGSTY 0.4.1 d12.aarch64.pg16 : postgresql-16-pg-grammar-guard postgresql-16-pg-grammar-guard_0.4.1-1PGSTY~bookworm_all.deb
| PIGSTY 0.4.1 d12.aarch64.pg15 : postgresql-15-pg-grammar-guard postgresql-15-pg-grammar-guard_0.4.1-1PGSTY~bookworm_all.deb
| PIGSTY 0.4.1 d12.aarch64.pg14 : postgresql-14-pg-grammar-guard postgresql-14-pg-grammar-guard_0.4.1-1PGSTY~bookworm_all.deb
|
| d13.x86_64 | PIGSTY 0.4.1 d13.x86_64.pg18 : postgresql-18-pg-grammar-guard postgresql-18-pg-grammar-guard_0.4.1-1PGSTY~trixie_all.deb
| PIGSTY 0.4.1 d13.x86_64.pg17 : postgresql-17-pg-grammar-guard postgresql-17-pg-grammar-guard_0.4.1-1PGSTY~trixie_all.deb
| PIGSTY 0.4.1 d13.x86_64.pg16 : postgresql-16-pg-grammar-guard postgresql-16-pg-grammar-guard_0.4.1-1PGSTY~trixie_all.deb
| PIGSTY 0.4.1 d13.x86_64.pg15 : postgresql-15-pg-grammar-guard postgresql-15-pg-grammar-guard_0.4.1-1PGSTY~trixie_all.deb
| PIGSTY 0.4.1 d13.x86_64.pg14 : postgresql-14-pg-grammar-guard postgresql-14-pg-grammar-guard_0.4.1-1PGSTY~trixie_all.deb
|
| d13.aarch64 | PIGSTY 0.4.1 d13.aarch64.pg18 : postgresql-18-pg-grammar-guard postgresql-18-pg-grammar-guard_0.4.1-1PGSTY~trixie_all.deb
| PIGSTY 0.4.1 d13.aarch64.pg17 : postgresql-17-pg-grammar-guard postgresql-17-pg-grammar-guard_0.4.1-1PGSTY~trixie_all.deb
| PIGSTY 0.4.1 d13.aarch64.pg16 : postgresql-16-pg-grammar-guard postgresql-16-pg-grammar-guard_0.4.1-1PGSTY~trixie_all.deb
| PIGSTY 0.4.1 d13.aarch64.pg15 : postgresql-15-pg-grammar-guard postgresql-15-pg-grammar-guard_0.4.1-1PGSTY~trixie_all.deb
| PIGSTY 0.4.1 d13.aarch64.pg14 : postgresql-14-pg-grammar-guard postgresql-14-pg-grammar-guard_0.4.1-1PGSTY~trixie_all.deb
|
| u22.x86_64 | PIGSTY 0.4.1 u22.x86_64.pg18 : postgresql-18-pg-grammar-guard postgresql-18-pg-grammar-guard_0.4.1-1PGSTY~jammy_all.deb
| PIGSTY 0.4.1 u22.x86_64.pg17 : postgresql-17-pg-grammar-guard postgresql-17-pg-grammar-guard_0.4.1-1PGSTY~jammy_all.deb
| PIGSTY 0.4.1 u22.x86_64.pg16 : postgresql-16-pg-grammar-guard postgresql-16-pg-grammar-guard_0.4.1-1PGSTY~jammy_all.deb
| PIGSTY 0.4.1 u22.x86_64.pg15 : postgresql-15-pg-grammar-guard postgresql-15-pg-grammar-guard_0.4.1-1PGSTY~jammy_all.deb
| PIGSTY 0.4.1 u22.x86_64.pg14 : postgresql-14-pg-grammar-guard postgresql-14-pg-grammar-guard_0.4.1-1PGSTY~jammy_all.deb
|
| u22.aarch64 | PIGSTY 0.4.1 u22.aarch64.pg18 : postgresql-18-pg-grammar-guard postgresql-18-pg-grammar-guard_0.4.1-1PGSTY~jammy_all.deb
| PIGSTY 0.4.1 u22.aarch64.pg17 : postgresql-17-pg-grammar-guard postgresql-17-pg-grammar-guard_0.4.1-1PGSTY~jammy_all.deb
| PIGSTY 0.4.1 u22.aarch64.pg16 : postgresql-16-pg-grammar-guard postgresql-16-pg-grammar-guard_0.4.1-1PGSTY~jammy_all.deb
| PIGSTY 0.4.1 u22.aarch64.pg15 : postgresql-15-pg-grammar-guard postgresql-15-pg-grammar-guard_0.4.1-1PGSTY~jammy_all.deb
| PIGSTY 0.4.1 u22.aarch64.pg14 : postgresql-14-pg-grammar-guard postgresql-14-pg-grammar-guard_0.4.1-1PGSTY~jammy_all.deb
|
| u24.x86_64 | PIGSTY 0.4.1 u24.x86_64.pg18 : postgresql-18-pg-grammar-guard postgresql-18-pg-grammar-guard_0.4.1-1PGSTY~noble_all.deb
| PIGSTY 0.4.1 u24.x86_64.pg17 : postgresql-17-pg-grammar-guard postgresql-17-pg-grammar-guard_0.4.1-1PGSTY~noble_all.deb
| PIGSTY 0.4.1 u24.x86_64.pg16 : postgresql-16-pg-grammar-guard postgresql-16-pg-grammar-guard_0.4.1-1PGSTY~noble_all.deb
| PIGSTY 0.4.1 u24.x86_64.pg15 : postgresql-15-pg-grammar-guard postgresql-15-pg-grammar-guard_0.4.1-1PGSTY~noble_all.deb
| PIGSTY 0.4.1 u24.x86_64.pg14 : postgresql-14-pg-grammar-guard postgresql-14-pg-grammar-guard_0.4.1-1PGSTY~noble_all.deb
|
| u24.aarch64 | PIGSTY 0.4.1 u24.aarch64.pg18 : postgresql-18-pg-grammar-guard postgresql-18-pg-grammar-guard_0.4.1-1PGSTY~noble_all.deb
| PIGSTY 0.4.1 u24.aarch64.pg17 : postgresql-17-pg-grammar-guard postgresql-17-pg-grammar-guard_0.4.1-1PGSTY~noble_all.deb
| PIGSTY 0.4.1 u24.aarch64.pg16 : postgresql-16-pg-grammar-guard postgresql-16-pg-grammar-guard_0.4.1-1PGSTY~noble_all.deb
| PIGSTY 0.4.1 u24.aarch64.pg15 : postgresql-15-pg-grammar-guard postgresql-15-pg-grammar-guard_0.4.1-1PGSTY~noble_all.deb
| PIGSTY 0.4.1 u24.aarch64.pg14 : postgresql-14-pg-grammar-guard postgresql-14-pg-grammar-guard_0.4.1-1PGSTY~noble_all.deb
|
| u26.x86_64 | PIGSTY 0.4.1 u26.x86_64.pg18 : postgresql-18-pg-grammar-guard postgresql-18-pg-grammar-guard_0.4.1-1PGSTY~resolute_all.deb
| PIGSTY 0.4.1 u26.x86_64.pg17 : postgresql-17-pg-grammar-guard postgresql-17-pg-grammar-guard_0.4.1-1PGSTY~resolute_all.deb
| PIGSTY 0.4.1 u26.x86_64.pg16 : postgresql-16-pg-grammar-guard postgresql-16-pg-grammar-guard_0.4.1-1PGSTY~resolute_all.deb
| PIGSTY 0.4.1 u26.x86_64.pg15 : postgresql-15-pg-grammar-guard postgresql-15-pg-grammar-guard_0.4.1-1PGSTY~resolute_all.deb
| PIGSTY 0.4.1 u26.x86_64.pg14 : postgresql-14-pg-grammar-guard postgresql-14-pg-grammar-guard_0.4.1-1PGSTY~resolute_all.deb
|
| u26.aarch64 | PIGSTY 0.4.1 u26.aarch64.pg18 : postgresql-18-pg-grammar-guard postgresql-18-pg-grammar-guard_0.4.1-1PGSTY~resolute_all.deb
| PIGSTY 0.4.1 u26.aarch64.pg17 : postgresql-17-pg-grammar-guard postgresql-17-pg-grammar-guard_0.4.1-1PGSTY~resolute_all.deb
| PIGSTY 0.4.1 u26.aarch64.pg16 : postgresql-16-pg-grammar-guard postgresql-16-pg-grammar-guard_0.4.1-1PGSTY~resolute_all.deb
| PIGSTY 0.4.1 u26.aarch64.pg15 : postgresql-15-pg-grammar-guard postgresql-15-pg-grammar-guard_0.4.1-1PGSTY~resolute_all.deb
| PIGSTY 0.4.1 u26.aarch64.pg14 : postgresql-14-pg-grammar-guard postgresql-14-pg-grammar-guard_0.4.1-1PGSTY~resolute_all.deb
|
Build
You can build the RPM / DEB packages for pg_grammar_guard using pig build:
Install
You can install pg_grammar_guard directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources:
pg_grammar_guard generates GBNF or JSON Schema from catalog identifiers and detects drift from approved grammars. It is pure SQL, needs no preload and is packaged for PostgreSQL 14–18. Its control file requires pg_living_assertions.
Generate a grammar
The catalog helpers enumerate actual tables, columns and enum labels. Generation supports nested objects and bounded arrays; open-ended values such as arbitrary SQL or file paths need separate validation.
Detect changes
grammar_guard.watch() stores the query that rebuilds a grammar, and grammar_guard.check_grammar() evaluates it against the live catalog. Results and their age are available through living_assertions.status.
Register baseline SQL only through trusted administrators. A grammar limits valid identifiers; it cannot prove that a selected table, join or answer is semantically correct. Baselines from the old 0.2 series lack the original generating query and require manual re-approval when upgrading.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)