pg_jsonschema
PostgreSQL extension providing JSON Schema validation
pg_jsonschema : PostgreSQL extension providing JSON Schema validation
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 2750 | pg_jsonschema | pg_jsonschema | 0.3.4 |
FEAT | Apache-2.0 | Rust |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| ----d-- | No | No | No | Yes | no | no |
| Relationships | |
|---|---|
| Need By | fsm_core |
| See Also | pgbson pgjq jsquery jsonschema pg_projection jsonb_plperl documentdb jsonb_plperlu jsonb_plpython3u mongo_fdw |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.3.4 |
18 17 16 15 14 | pg_jsonschema |
- |
| RPM | PIGSTY | 0.3.4 |
18 17 16 15 14 | pg_jsonschema_$v |
- |
| DEB | PIGSTY | 0.3.4 |
18 17 16 15 14 | postgresql-$v-pg-jsonschema |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| el8.aarch64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| el9.x86_64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| el9.aarch64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| el10.x86_64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| el10.aarch64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| d12.x86_64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| d12.aarch64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| d13.x86_64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| d13.aarch64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| u22.x86_64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| u22.aarch64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| u24.x86_64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| u24.aarch64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| u26.x86_64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
| u26.aarch64 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 | PIGSTY 0.3.4 |
Source
github.com/supabase/pg_jsonschema
pg_jsonschema-0.3.4.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
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: