pgproto

pgproto

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

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
4130
pgproto
pgproto
0.3.3
UTIL
PostgreSQL
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
pg_protobuf
pg_jsonschema
pg_csv

release 0.3.3; SQL v1.0

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
0.3.3
18
17
16
15
14
pgproto-
RPM
PIGSTY
0.3.3
18
17
16
15
14
pgproto_$v-
DEB
PIGSTY
0.3.3
18
17
16
15
14
postgresql-$v-pgproto-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
el8.aarch64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
el9.x86_64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
el9.aarch64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
el10.x86_64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
el10.aarch64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
d12.x86_64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
d12.aarch64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
d13.x86_64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
d13.aarch64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
u22.x86_64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
u22.aarch64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
u24.x86_64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
u24.aarch64
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PIGSTY 0.3.3
PackageVersionOSORGSIZEFile URL
pgproto_180.3.3el8.x86_64pigsty228.6 KiBpgproto_18-0.3.3-1PIGSTY.el8.x86_64.rpm
pgproto_180.3.3el8.aarch64pigsty213.0 KiBpgproto_18-0.3.3-1PIGSTY.el8.aarch64.rpm
pgproto_180.3.3el9.x86_64pigsty127.3 KiBpgproto_18-0.3.3-1PIGSTY.el9.x86_64.rpm
pgproto_180.3.3el9.aarch64pigsty124.9 KiBpgproto_18-0.3.3-1PIGSTY.el9.aarch64.rpm
pgproto_180.3.3el10.x86_64pigsty129.2 KiBpgproto_18-0.3.3-1PIGSTY.el10.x86_64.rpm
pgproto_180.3.3el10.aarch64pigsty125.0 KiBpgproto_18-0.3.3-1PIGSTY.el10.aarch64.rpm
postgresql-18-pgproto0.3.3d12.x86_64pigsty697.5 KiBpostgresql-18-pgproto_0.3.3-1PIGSTY~bookworm_amd64.deb
postgresql-18-pgproto0.3.3d12.aarch64pigsty693.2 KiBpostgresql-18-pgproto_0.3.3-1PIGSTY~bookworm_arm64.deb
postgresql-18-pgproto0.3.3d13.x86_64pigsty703.2 KiBpostgresql-18-pgproto_0.3.3-1PIGSTY~trixie_amd64.deb
postgresql-18-pgproto0.3.3d13.aarch64pigsty696.1 KiBpostgresql-18-pgproto_0.3.3-1PIGSTY~trixie_arm64.deb
postgresql-18-pgproto0.3.3u22.x86_64pigsty755.0 KiBpostgresql-18-pgproto_0.3.3-1PIGSTY~jammy_amd64.deb
postgresql-18-pgproto0.3.3u22.aarch64pigsty754.3 KiBpostgresql-18-pgproto_0.3.3-1PIGSTY~jammy_arm64.deb
postgresql-18-pgproto0.3.3u24.x86_64pigsty733.0 KiBpostgresql-18-pgproto_0.3.3-1PIGSTY~noble_amd64.deb
postgresql-18-pgproto0.3.3u24.aarch64pigsty742.9 KiBpostgresql-18-pgproto_0.3.3-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pgproto_170.3.3el8.x86_64pigsty228.6 KiBpgproto_17-0.3.3-1PIGSTY.el8.x86_64.rpm
pgproto_170.3.3el8.aarch64pigsty213.0 KiBpgproto_17-0.3.3-1PIGSTY.el8.aarch64.rpm
pgproto_170.3.3el9.x86_64pigsty127.3 KiBpgproto_17-0.3.3-1PIGSTY.el9.x86_64.rpm
pgproto_170.3.3el9.aarch64pigsty124.9 KiBpgproto_17-0.3.3-1PIGSTY.el9.aarch64.rpm
pgproto_170.3.3el10.x86_64pigsty129.2 KiBpgproto_17-0.3.3-1PIGSTY.el10.x86_64.rpm
pgproto_170.3.3el10.aarch64pigsty125.0 KiBpgproto_17-0.3.3-1PIGSTY.el10.aarch64.rpm
postgresql-17-pgproto0.3.3d12.x86_64pigsty697.4 KiBpostgresql-17-pgproto_0.3.3-1PIGSTY~bookworm_amd64.deb
postgresql-17-pgproto0.3.3d12.aarch64pigsty693.0 KiBpostgresql-17-pgproto_0.3.3-1PIGSTY~bookworm_arm64.deb
postgresql-17-pgproto0.3.3d13.x86_64pigsty702.9 KiBpostgresql-17-pgproto_0.3.3-1PIGSTY~trixie_amd64.deb
postgresql-17-pgproto0.3.3d13.aarch64pigsty696.3 KiBpostgresql-17-pgproto_0.3.3-1PIGSTY~trixie_arm64.deb
postgresql-17-pgproto0.3.3u22.x86_64pigsty814.3 KiBpostgresql-17-pgproto_0.3.3-1PIGSTY~jammy_amd64.deb
postgresql-17-pgproto0.3.3u22.aarch64pigsty812.8 KiBpostgresql-17-pgproto_0.3.3-1PIGSTY~jammy_arm64.deb
postgresql-17-pgproto0.3.3u24.x86_64pigsty733.0 KiBpostgresql-17-pgproto_0.3.3-1PIGSTY~noble_amd64.deb
postgresql-17-pgproto0.3.3u24.aarch64pigsty742.8 KiBpostgresql-17-pgproto_0.3.3-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pgproto_160.3.3el8.x86_64pigsty228.7 KiBpgproto_16-0.3.3-1PIGSTY.el8.x86_64.rpm
pgproto_160.3.3el8.aarch64pigsty213.0 KiBpgproto_16-0.3.3-1PIGSTY.el8.aarch64.rpm
pgproto_160.3.3el9.x86_64pigsty127.3 KiBpgproto_16-0.3.3-1PIGSTY.el9.x86_64.rpm
pgproto_160.3.3el9.aarch64pigsty124.9 KiBpgproto_16-0.3.3-1PIGSTY.el9.aarch64.rpm
pgproto_160.3.3el10.x86_64pigsty129.2 KiBpgproto_16-0.3.3-1PIGSTY.el10.x86_64.rpm
pgproto_160.3.3el10.aarch64pigsty125.0 KiBpgproto_16-0.3.3-1PIGSTY.el10.aarch64.rpm
postgresql-16-pgproto0.3.3d12.x86_64pigsty697.3 KiBpostgresql-16-pgproto_0.3.3-1PIGSTY~bookworm_amd64.deb
postgresql-16-pgproto0.3.3d12.aarch64pigsty693.1 KiBpostgresql-16-pgproto_0.3.3-1PIGSTY~bookworm_arm64.deb
postgresql-16-pgproto0.3.3d13.x86_64pigsty703.0 KiBpostgresql-16-pgproto_0.3.3-1PIGSTY~trixie_amd64.deb
postgresql-16-pgproto0.3.3d13.aarch64pigsty696.2 KiBpostgresql-16-pgproto_0.3.3-1PIGSTY~trixie_arm64.deb
postgresql-16-pgproto0.3.3u22.x86_64pigsty814.3 KiBpostgresql-16-pgproto_0.3.3-1PIGSTY~jammy_amd64.deb
postgresql-16-pgproto0.3.3u22.aarch64pigsty812.8 KiBpostgresql-16-pgproto_0.3.3-1PIGSTY~jammy_arm64.deb
postgresql-16-pgproto0.3.3u24.x86_64pigsty733.0 KiBpostgresql-16-pgproto_0.3.3-1PIGSTY~noble_amd64.deb
postgresql-16-pgproto0.3.3u24.aarch64pigsty742.9 KiBpostgresql-16-pgproto_0.3.3-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pgproto_150.3.3el8.x86_64pigsty239.7 KiBpgproto_15-0.3.3-1PIGSTY.el8.x86_64.rpm
pgproto_150.3.3el8.aarch64pigsty223.5 KiBpgproto_15-0.3.3-1PIGSTY.el8.aarch64.rpm
pgproto_150.3.3el9.x86_64pigsty219.1 KiBpgproto_15-0.3.3-1PIGSTY.el9.x86_64.rpm
pgproto_150.3.3el9.aarch64pigsty212.0 KiBpgproto_15-0.3.3-1PIGSTY.el9.aarch64.rpm
pgproto_150.3.3el10.x86_64pigsty223.4 KiBpgproto_15-0.3.3-1PIGSTY.el10.x86_64.rpm
pgproto_150.3.3el10.aarch64pigsty213.7 KiBpgproto_15-0.3.3-1PIGSTY.el10.aarch64.rpm
postgresql-15-pgproto0.3.3d12.x86_64pigsty707.0 KiBpostgresql-15-pgproto_0.3.3-1PIGSTY~bookworm_amd64.deb
postgresql-15-pgproto0.3.3d12.aarch64pigsty702.2 KiBpostgresql-15-pgproto_0.3.3-1PIGSTY~bookworm_arm64.deb
postgresql-15-pgproto0.3.3d13.x86_64pigsty712.7 KiBpostgresql-15-pgproto_0.3.3-1PIGSTY~trixie_amd64.deb
postgresql-15-pgproto0.3.3d13.aarch64pigsty705.8 KiBpostgresql-15-pgproto_0.3.3-1PIGSTY~trixie_arm64.deb
postgresql-15-pgproto0.3.3u22.x86_64pigsty822.2 KiBpostgresql-15-pgproto_0.3.3-1PIGSTY~jammy_amd64.deb
postgresql-15-pgproto0.3.3u22.aarch64pigsty819.9 KiBpostgresql-15-pgproto_0.3.3-1PIGSTY~jammy_arm64.deb
postgresql-15-pgproto0.3.3u24.x86_64pigsty741.3 KiBpostgresql-15-pgproto_0.3.3-1PIGSTY~noble_amd64.deb
postgresql-15-pgproto0.3.3u24.aarch64pigsty749.8 KiBpostgresql-15-pgproto_0.3.3-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pgproto_140.3.3el8.x86_64pigsty239.7 KiBpgproto_14-0.3.3-1PIGSTY.el8.x86_64.rpm
pgproto_140.3.3el8.aarch64pigsty223.5 KiBpgproto_14-0.3.3-1PIGSTY.el8.aarch64.rpm
pgproto_140.3.3el9.x86_64pigsty219.2 KiBpgproto_14-0.3.3-1PIGSTY.el9.x86_64.rpm
pgproto_140.3.3el9.aarch64pigsty212.0 KiBpgproto_14-0.3.3-1PIGSTY.el9.aarch64.rpm
pgproto_140.3.3el10.x86_64pigsty223.0 KiBpgproto_14-0.3.3-1PIGSTY.el10.x86_64.rpm
pgproto_140.3.3el10.aarch64pigsty215.5 KiBpgproto_14-0.3.3-1PIGSTY.el10.aarch64.rpm
postgresql-14-pgproto0.3.3d12.x86_64pigsty706.9 KiBpostgresql-14-pgproto_0.3.3-1PIGSTY~bookworm_amd64.deb
postgresql-14-pgproto0.3.3d12.aarch64pigsty701.9 KiBpostgresql-14-pgproto_0.3.3-1PIGSTY~bookworm_arm64.deb
postgresql-14-pgproto0.3.3d13.x86_64pigsty712.5 KiBpostgresql-14-pgproto_0.3.3-1PIGSTY~trixie_amd64.deb
postgresql-14-pgproto0.3.3d13.aarch64pigsty705.7 KiBpostgresql-14-pgproto_0.3.3-1PIGSTY~trixie_arm64.deb
postgresql-14-pgproto0.3.3u22.x86_64pigsty822.2 KiBpostgresql-14-pgproto_0.3.3-1PIGSTY~jammy_amd64.deb
postgresql-14-pgproto0.3.3u22.aarch64pigsty819.9 KiBpostgresql-14-pgproto_0.3.3-1PIGSTY~jammy_arm64.deb
postgresql-14-pgproto0.3.3u24.x86_64pigsty741.3 KiBpostgresql-14-pgproto_0.3.3-1PIGSTY~noble_amd64.deb
postgresql-14-pgproto0.3.3u24.aarch64pigsty749.8 KiBpostgresql-14-pgproto_0.3.3-1PIGSTY~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