pg_jsonschema
PostgreSQL extension providing JSON Schema validation
Repository
supabase/pg_jsonschema
https://github.com/supabase/pg_jsonschema
Source
pg_jsonschema-0.3.4.tar.gz
pg_jsonschema-0.3.4.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_jsonschema | 0.3.4 | FEAT | Apache-2.0 | Rust |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2750 | pg_jsonschema | No | No | No | Yes | No | No | - |
| Related | pgbson pgjq jsquery jsonschema pg_projection jsonb_plperl documentdb jsonb_plperlu jsonb_plpython3u mongo_fdw |
|---|---|
| Depended By | fsm_core |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.3.4 | 1817161514 | pg_jsonschema | - |
| RPM | PIGSTY | 0.3.4 | 1817161514 | pg_jsonschema_$v | - |
| DEB | PIGSTY | 0.3.4 | 1817161514 | postgresql-$v-pg-jsonschema | - |
Build
You can build the RPM / DEB packages for pg_jsonschema using pig build:
Install
You can install pg_jsonschema directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
Usage
pg_jsonschema: PostgreSQL extension providing JSON Schema validation
pg_jsonschema adds JSON Schema validation functions to PostgreSQL, enabling schema enforcement on JSON/JSONB columns via check constraints.
Functions
| Function | Description |
|---|---|
json_matches_schema(schema json, instance json) | Validate a JSON instance against a schema, returns boolean |
jsonb_matches_schema(schema json, instance jsonb) | Validate a JSONB instance against a schema, returns boolean |
jsonschema_is_valid(schema json) | Check whether a JSON schema itself is valid |
jsonschema_validation_errors(schema json, instance json) | Return an array of validation error messages |
Table Constraints
Use check constraints to enforce document structure:
Error Inspection
Retrieve detailed validation errors:
Schema Validation
Verify that a schema is well-formed before using it:
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)