postgres_protobuf
postgres_protobuf · C++ functions for querying protobuf values stored as bytea and converting Protocol Buffers to and from their JSON representation.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100064 | postgres_protobuf | postgres_protobuf | 0.2 | UTIL | MIT | C++ |
PostgreSQL · 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
postgres_protobuf stores Protocol Buffer schemas and queries protobuf values held as bytea. It can select one field, arrays, or row sets and convert messages to and from their JSON representation.
Generate the descriptor set with protoc, including imports, and insert it in a committed transaction before querying. Related functions include protobuf_query_array, protobuf_query_multi, protobuf_to_json_text, and protobuf_from_json_text.
Upstream warns against untrusted queries or unvalidated protobuf bytes. Large or recursive map-heavy messages can consume substantial C++ heap memory outside ordinary PostgreSQL accounting; every query scans the message, schemas are cached only for one transaction, and schema-dependent query functions cannot safely serve as index expressions. Proto3 missing/default fields yield no result, deprecated groups are unsupported, and the reviewed implementation was AMD64-only. Set input limits, validate and reserialize outside the database, restrict descriptor changes, and benchmark memory and latency.