pg_grammar_guard
pg_grammar_guard · Catalog-derived grammars and approved grammar drift checks
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 1890 | pg_grammar_guard | pg_grammar_guard | 0.4.10 | RAG | Apache-2.0 | SQL |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| ----d-- | No | No | No | Yes | no | no |
| Relationships | |
|---|---|
| Schemas | grammar_guard |
| Requires | pg_living_assertions |
Packages
| Linux / PG | PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|---|
| el8.x86_64 | N/A | PIGSTY 0.4.9 | PIGSTY 0.4.9 | PIGSTY 0.4.9 | PIGSTY 0.4.9 |
| el8.aarch64 | N/A | PIGSTY 0.4.9 | PIGSTY 0.4.9 | PIGSTY 0.4.9 | PIGSTY 0.4.9 |
| el9.x86_64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| el9.aarch64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| el10.x86_64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| el10.aarch64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| d12.x86_64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| d12.aarch64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| d13.x86_64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| d13.aarch64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| u22.x86_64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| u22.aarch64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| u24.x86_64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| u24.aarch64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| u26.x86_64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
| u26.aarch64 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 | PIGSTY 0.4.10 |
Source
github.com/Manuelreyesbravo/pg_grammar_guard
pg_grammar_guard-0.4.10.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
Sources:
pg_grammar_guard 0.4.10 creates GBNF or JSON Schema from catalog identifiers and watches approved grammars for drift. It is pure SQL and requires pg_living_assertions 0.5.6 or later (0.5.10 or later recommended).
Core Workflow
Operational Boundaries
grammar_guard.catalog_tables() and grammar_guard.catalog_columns() expose catalog names; grammar_guard.grammar_for_json() assembles typed fields, nested structures and bounded arrays. grammar_guard.watch() records the SQL that regenerates a grammar, and grammar_guard.check_grammar() compares it with the approved state in living_assertions.status. The generating query resolves with its author search path and executes as that author. Input NULLs, empty/duplicate field names, empty pivots and invalid bounds are rejected; max_items is capped at 1000. Version 0.4.8 changes canonical fingerprints, and the ordered catalog list can make an existing watch fail once: inspect and re-approve it. A grammar controls allowed tokens, not semantic correctness or authorization. Register trusted SQL only. No preload is required. Current Apache-2.0 licensing begins at 0.4.4; earlier releases retain their original license.
Current Compatibility
Version 0.4.10 updates documentation and tested compatibility without changing SQL objects. Upstream records PostgreSQL 11–19 coverage. The supplied 0.4.9-to-0.4.10 SQL update advances the extension version only; keep the earlier role and dependency requirements above.