Skip to content

pg_jsontailor

Writable JSON document views with ETags over relational tables.

pg_jsontailor · Writable JSON document views with ETags over relational tables.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102323pg_jsontailorpg_jsontailor0.2.0FEATPostgreSQLPLpgSQL

PostgreSQL · 17, 18

Usage

Sources:

pg_jsontailor development version 0.2.0 generates writable JSON views over relational tables with optimistic concurrency checks.

Core Workflow

jsontailor.duality_view_ddl returns the DDL for review before execution. The supported shape is one root table, an optional read-only many-to-one object and an optional writable one-to-many array. Updates replace complete documents and must present the preceding ETag; guarded deletion also checks that tag.

CREATE EXTENSION pg_jsontailor;
CREATE SCHEMA shop;
CREATE SCHEMA api;
CREATE TABLE shop.orders (order_id bigint PRIMARY KEY, status text);
SELECT jsontailor.create_duality_view(
  'api.orders_dv',
  '{"root":{"table":"shop.orders","key":"order_id",
    "fields":{"status":"status"},"insert":true,"update":true,"delete":true}}'::jsonb
);
SELECT data FROM api.orders_dv;

Operational Boundaries

This is an unreleased evaluation/controlled-pilot version for PostgreSQL 17–19, implemented in SQL and PL/pgSQL without preload. Generated access follows invoker privileges and row-level security; creating a view does not authorize broader table access. Generated DDL has no runtime extension dependency. It is not a complete Oracle duality-view or ORDS compatibility layer.

Table reader