pgproto

pgproto

pgproto : Native Protobuf parsing, mutation, indexing, and JSON conversion support

Overview

ID Extension Package Version Category License Language
4130
pgproto
pgproto
0.2.1
UTIL
PostgreSQL
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
pg_protobuf
pg_jsonschema
pg_csv

Extension SQL default_version is 1.0 while the packaged upstream release version is 0.2.1.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
0.2.1
18
17
16
15
14
pgproto -
RPM
PIGSTY
0.2.1
18
17
16
15
14
pgproto_$v -
DEB
PIGSTY
0.2.1
18
17
16
15
14
postgresql-$v-pgproto -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
el8.aarch64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
el9.x86_64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
el9.aarch64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
el10.x86_64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
el10.aarch64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
d12.x86_64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
d12.aarch64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
d13.x86_64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
d13.aarch64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
u22.x86_64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
u22.aarch64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
u24.x86_64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
u24.aarch64
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
PIGSTY 0.2.1
Package Version OS ORG SIZE File URL
pgproto_18 0.2.1 el8.x86_64 pigsty 160.9 KiB pgproto_18-0.2.1-1PIGSTY.el8.x86_64.rpm
pgproto_18 0.2.1 el8.aarch64 pigsty 153.3 KiB pgproto_18-0.2.1-1PIGSTY.el8.aarch64.rpm
pgproto_18 0.2.1 el9.x86_64 pigsty 100.0 KiB pgproto_18-0.2.1-2PIGSTY.el9.x86_64.rpm
pgproto_18 0.2.1 el9.aarch64 pigsty 96.5 KiB pgproto_18-0.2.1-2PIGSTY.el9.aarch64.rpm
pgproto_18 0.2.1 el10.x86_64 pigsty 101.7 KiB pgproto_18-0.2.1-2PIGSTY.el10.x86_64.rpm
pgproto_18 0.2.1 el10.aarch64 pigsty 96.5 KiB pgproto_18-0.2.1-2PIGSTY.el10.aarch64.rpm
postgresql-18-pgproto 0.2.1 d12.x86_64 pigsty 482.9 KiB postgresql-18-pgproto_0.2.1-2PIGSTY~bookworm_amd64.deb
postgresql-18-pgproto 0.2.1 d12.aarch64 pigsty 480.0 KiB postgresql-18-pgproto_0.2.1-2PIGSTY~bookworm_arm64.deb
postgresql-18-pgproto 0.2.1 d13.x86_64 pigsty 486.2 KiB postgresql-18-pgproto_0.2.1-2PIGSTY~trixie_amd64.deb
postgresql-18-pgproto 0.2.1 d13.aarch64 pigsty 481.4 KiB postgresql-18-pgproto_0.2.1-2PIGSTY~trixie_arm64.deb
postgresql-18-pgproto 0.2.1 u22.x86_64 pigsty 518.0 KiB postgresql-18-pgproto_0.2.1-2PIGSTY~jammy_amd64.deb
postgresql-18-pgproto 0.2.1 u22.aarch64 pigsty 478.0 KiB postgresql-18-pgproto_0.2.1-2PIGSTY~jammy_arm64.deb
postgresql-18-pgproto 0.2.1 u24.x86_64 pigsty 507.0 KiB postgresql-18-pgproto_0.2.1-2PIGSTY~noble_amd64.deb
postgresql-18-pgproto 0.2.1 u24.aarch64 pigsty 511.6 KiB postgresql-18-pgproto_0.2.1-2PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pgproto_17 0.2.1 el8.x86_64 pigsty 160.9 KiB pgproto_17-0.2.1-1PIGSTY.el8.x86_64.rpm
pgproto_17 0.2.1 el8.aarch64 pigsty 153.3 KiB pgproto_17-0.2.1-1PIGSTY.el8.aarch64.rpm
pgproto_17 0.2.1 el9.x86_64 pigsty 100.0 KiB pgproto_17-0.2.1-2PIGSTY.el9.x86_64.rpm
pgproto_17 0.2.1 el9.aarch64 pigsty 96.5 KiB pgproto_17-0.2.1-2PIGSTY.el9.aarch64.rpm
pgproto_17 0.2.1 el10.x86_64 pigsty 101.7 KiB pgproto_17-0.2.1-2PIGSTY.el10.x86_64.rpm
pgproto_17 0.2.1 el10.aarch64 pigsty 96.5 KiB pgproto_17-0.2.1-2PIGSTY.el10.aarch64.rpm
postgresql-17-pgproto 0.2.1 d12.x86_64 pigsty 482.7 KiB postgresql-17-pgproto_0.2.1-2PIGSTY~bookworm_amd64.deb
postgresql-17-pgproto 0.2.1 d12.aarch64 pigsty 480.0 KiB postgresql-17-pgproto_0.2.1-2PIGSTY~bookworm_arm64.deb
postgresql-17-pgproto 0.2.1 d13.x86_64 pigsty 486.2 KiB postgresql-17-pgproto_0.2.1-2PIGSTY~trixie_amd64.deb
postgresql-17-pgproto 0.2.1 d13.aarch64 pigsty 481.2 KiB postgresql-17-pgproto_0.2.1-2PIGSTY~trixie_arm64.deb
postgresql-17-pgproto 0.2.1 u22.x86_64 pigsty 557.3 KiB postgresql-17-pgproto_0.2.1-2PIGSTY~jammy_amd64.deb
postgresql-17-pgproto 0.2.1 u22.aarch64 pigsty 516.2 KiB postgresql-17-pgproto_0.2.1-2PIGSTY~jammy_arm64.deb
postgresql-17-pgproto 0.2.1 u24.x86_64 pigsty 507.0 KiB postgresql-17-pgproto_0.2.1-2PIGSTY~noble_amd64.deb
postgresql-17-pgproto 0.2.1 u24.aarch64 pigsty 511.5 KiB postgresql-17-pgproto_0.2.1-2PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pgproto_16 0.2.1 el8.x86_64 pigsty 160.9 KiB pgproto_16-0.2.1-1PIGSTY.el8.x86_64.rpm
pgproto_16 0.2.1 el8.aarch64 pigsty 153.3 KiB pgproto_16-0.2.1-1PIGSTY.el8.aarch64.rpm
pgproto_16 0.2.1 el9.x86_64 pigsty 100.0 KiB pgproto_16-0.2.1-2PIGSTY.el9.x86_64.rpm
pgproto_16 0.2.1 el9.aarch64 pigsty 96.5 KiB pgproto_16-0.2.1-2PIGSTY.el9.aarch64.rpm
pgproto_16 0.2.1 el10.x86_64 pigsty 101.7 KiB pgproto_16-0.2.1-2PIGSTY.el10.x86_64.rpm
pgproto_16 0.2.1 el10.aarch64 pigsty 96.5 KiB pgproto_16-0.2.1-2PIGSTY.el10.aarch64.rpm
postgresql-16-pgproto 0.2.1 d12.x86_64 pigsty 482.8 KiB postgresql-16-pgproto_0.2.1-2PIGSTY~bookworm_amd64.deb
postgresql-16-pgproto 0.2.1 d12.aarch64 pigsty 480.0 KiB postgresql-16-pgproto_0.2.1-2PIGSTY~bookworm_arm64.deb
postgresql-16-pgproto 0.2.1 d13.x86_64 pigsty 486.2 KiB postgresql-16-pgproto_0.2.1-2PIGSTY~trixie_amd64.deb
postgresql-16-pgproto 0.2.1 d13.aarch64 pigsty 481.1 KiB postgresql-16-pgproto_0.2.1-2PIGSTY~trixie_arm64.deb
postgresql-16-pgproto 0.2.1 u22.x86_64 pigsty 557.3 KiB postgresql-16-pgproto_0.2.1-2PIGSTY~jammy_amd64.deb
postgresql-16-pgproto 0.2.1 u22.aarch64 pigsty 516.2 KiB postgresql-16-pgproto_0.2.1-2PIGSTY~jammy_arm64.deb
postgresql-16-pgproto 0.2.1 u24.x86_64 pigsty 506.9 KiB postgresql-16-pgproto_0.2.1-2PIGSTY~noble_amd64.deb
postgresql-16-pgproto 0.2.1 u24.aarch64 pigsty 511.3 KiB postgresql-16-pgproto_0.2.1-2PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pgproto_15 0.2.1 el8.x86_64 pigsty 169.0 KiB pgproto_15-0.2.1-1PIGSTY.el8.x86_64.rpm
pgproto_15 0.2.1 el8.aarch64 pigsty 160.5 KiB pgproto_15-0.2.1-1PIGSTY.el8.aarch64.rpm
pgproto_15 0.2.1 el9.x86_64 pigsty 156.7 KiB pgproto_15-0.2.1-2PIGSTY.el9.x86_64.rpm
pgproto_15 0.2.1 el9.aarch64 pigsty 151.5 KiB pgproto_15-0.2.1-2PIGSTY.el9.aarch64.rpm
pgproto_15 0.2.1 el10.x86_64 pigsty 157.7 KiB pgproto_15-0.2.1-2PIGSTY.el10.x86_64.rpm
pgproto_15 0.2.1 el10.aarch64 pigsty 151.8 KiB pgproto_15-0.2.1-2PIGSTY.el10.aarch64.rpm
postgresql-15-pgproto 0.2.1 d12.x86_64 pigsty 490.6 KiB postgresql-15-pgproto_0.2.1-2PIGSTY~bookworm_amd64.deb
postgresql-15-pgproto 0.2.1 d12.aarch64 pigsty 487.9 KiB postgresql-15-pgproto_0.2.1-2PIGSTY~bookworm_arm64.deb
postgresql-15-pgproto 0.2.1 d13.x86_64 pigsty 494.0 KiB postgresql-15-pgproto_0.2.1-2PIGSTY~trixie_amd64.deb
postgresql-15-pgproto 0.2.1 d13.aarch64 pigsty 489.1 KiB postgresql-15-pgproto_0.2.1-2PIGSTY~trixie_arm64.deb
postgresql-15-pgproto 0.2.1 u22.x86_64 pigsty 564.1 KiB postgresql-15-pgproto_0.2.1-2PIGSTY~jammy_amd64.deb
postgresql-15-pgproto 0.2.1 u22.aarch64 pigsty 565.5 KiB postgresql-15-pgproto_0.2.1-2PIGSTY~jammy_arm64.deb
postgresql-15-pgproto 0.2.1 u24.x86_64 pigsty 512.8 KiB postgresql-15-pgproto_0.2.1-2PIGSTY~noble_amd64.deb
postgresql-15-pgproto 0.2.1 u24.aarch64 pigsty 517.9 KiB postgresql-15-pgproto_0.2.1-2PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pgproto_14 0.2.1 el8.x86_64 pigsty 169.0 KiB pgproto_14-0.2.1-1PIGSTY.el8.x86_64.rpm
pgproto_14 0.2.1 el8.aarch64 pigsty 160.5 KiB pgproto_14-0.2.1-1PIGSTY.el8.aarch64.rpm
pgproto_14 0.2.1 el9.x86_64 pigsty 156.7 KiB pgproto_14-0.2.1-2PIGSTY.el9.x86_64.rpm
pgproto_14 0.2.1 el9.aarch64 pigsty 151.2 KiB pgproto_14-0.2.1-2PIGSTY.el9.aarch64.rpm
pgproto_14 0.2.1 el10.x86_64 pigsty 157.6 KiB pgproto_14-0.2.1-2PIGSTY.el10.x86_64.rpm
pgproto_14 0.2.1 el10.aarch64 pigsty 152.1 KiB pgproto_14-0.2.1-2PIGSTY.el10.aarch64.rpm
postgresql-14-pgproto 0.2.1 d12.x86_64 pigsty 490.6 KiB postgresql-14-pgproto_0.2.1-2PIGSTY~bookworm_amd64.deb
postgresql-14-pgproto 0.2.1 d12.aarch64 pigsty 487.9 KiB postgresql-14-pgproto_0.2.1-2PIGSTY~bookworm_arm64.deb
postgresql-14-pgproto 0.2.1 d13.x86_64 pigsty 494.1 KiB postgresql-14-pgproto_0.2.1-2PIGSTY~trixie_amd64.deb
postgresql-14-pgproto 0.2.1 d13.aarch64 pigsty 488.9 KiB postgresql-14-pgproto_0.2.1-2PIGSTY~trixie_arm64.deb
postgresql-14-pgproto 0.2.1 u22.x86_64 pigsty 564.1 KiB postgresql-14-pgproto_0.2.1-2PIGSTY~jammy_amd64.deb
postgresql-14-pgproto 0.2.1 u22.aarch64 pigsty 565.5 KiB postgresql-14-pgproto_0.2.1-2PIGSTY~jammy_arm64.deb
postgresql-14-pgproto 0.2.1 u24.x86_64 pigsty 512.8 KiB postgresql-14-pgproto_0.2.1-2PIGSTY~noble_amd64.deb
postgresql-14-pgproto 0.2.1 u24.aarch64 pigsty 518.0 KiB postgresql-14-pgproto_0.2.1-2PIGSTY~noble_arm64.deb

Source

pig build pkg pgproto;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pgproto;		# install via package name, for the active PG version

pig install pgproto -v 18;   # install for PG 18
pig install pgproto -v 17;   # install for PG 17
pig install pgproto -v 16;   # install for PG 16
pig install pgproto -v 15;   # install for PG 15
pig install pgproto -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION pgproto;

Usage

Syntax:

CREATE EXTENSION pgproto;
INSERT INTO pb_schemas (name, data) VALUES ('MySchema', '\x...');
CREATE TABLE items (id serial PRIMARY KEY, data protobuf);
SELECT data #> '{Outer, inner, id}'::text[] FROM items;

Source: README

pgproto adds native Protocol Buffers support to PostgreSQL. It provides a protobuf type, runtime schema registration, nested field extraction, update helpers, and indexing support for schema-aware access to protobuf payloads.

Setup

Enable the extension:

CREATE EXTENSION pgproto;

Register protobuf schemas by loading FileDescriptorSet blobs:

INSERT INTO pb_schemas (name, data) VALUES ('MySchema', '\x...');

Create a table using the custom protobuf type:

CREATE TABLE items (
    id SERIAL PRIMARY KEY,
    data protobuf
);

Querying

The README highlights nested field extraction with PostgreSQL-style operators:

SELECT data #> '{Outer, inner, id}'::text[] FROM items;
SELECT data #> '{Outer, tags, mykey}'::text[] FROM items;

It also mentions custom operators such as -> and #> for schema-aware navigation.

Modification Functions

pgproto includes pure functions that return a new protobuf value:

  • pb_set(...)
  • pb_insert(...)
  • pb_delete(...)

Because they return modified values rather than mutating in place, they are normally used in UPDATE statements:

UPDATE items SET data = pb_set(data, ARRAY['Outer', 'a'], '42');
UPDATE items SET data = pb_insert(data, ARRAY['Outer', 'scores', '0'], '100');
UPDATE items SET data = pb_delete(data, ARRAY['Outer', 'a']);

The || operator merges two protobuf messages of the same type.

Indexing

The README documents B-tree expression indexes on extracted fields:

CREATE INDEX idx_pb_id ON items ((data #> '{Outer, inner, id}'::text[]));

The project also advertises GIN support for retrieval workflows.

Notes

The upstream README positions pgproto as more storage-efficient than JSONB for protobuf-native payloads and highlights protobuf schema evolution, enums, oneof, and map/repeated field access as supported use cases.

Last updated on