cbor
cbor · Concise Binary Object Representation data type for PostgreSQL.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100250 | cbor | cbor | 0.1.0 | TYPE | PostgreSQL | C |
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
cbor adds a Concise Binary Object Representation type based on RFC 7049. Use it when a database must store and exchange CBOR bytes while retaining a textual SQL representation; it is not a replacement for jsonb query and indexing features.
Encode and Decode
cbor_encode(cbor) returns the binary representation as bytea; cbor_decode(bytea) parses binary CBOR. The type’s text input and output cover integers, byte and text strings, arrays, maps, tags, floating-point values, and simple values.
Operators and Indexes
The extension supplies =, <>, <, <=, >, and >=, plus default B-tree and hash operator classes. It also exposes cbor_contains(cbor, cbor) and cbor_contained(cbor, cbor) functions, but version 0.1.0 does not define containment operators.
This old release targets the original RFC 7049 rather than the later RFC 8949 specification. Before exchanging data with other implementations, test tags, floating-point values, duplicate map keys, ordering, canonical encoding, and equality semantics. Preserve the original bytea if byte-for-byte identity matters, because a decode/encode round trip need not preserve an external encoder’s exact representation.