postgres_protobuf
postgres_protobuf 提供 C++ 函数,用于查询以 bytea 存储的 Protobuf,并在 Protocol Buffers 与其 JSON 表示之间转换。
postgres_protobuf · postgres_protobuf 提供 C++ 函数,用于查询以 bytea 存储的 Protobuf,并在 Protocol Buffers 与其 JSON 表示之间转换。
概览
| ID | 扩展 | 软件包 | 版本 | 类别 | 许可证 | 编程语言 |
|---|---|---|---|---|---|---|
| 100064 | postgres_protobuf | postgres_protobuf | 0.2 | UTIL | MIT | C++ |
PostgreSQL · 11, 12, 13, 14, 15, 16, 17, 18
用法
来源:
postgres_protobuf 存储 Protocol Buffer 模式,并查询以 bytea 保存的 protobuf 值。它可以选择单个字段、数组或行集,还能在消息与其 JSON 表示之间转换。
应使用 protoc 生成包含导入项的描述符集,并在查询前把它插入且提交。相关函数包括 protobuf_query_array、protobuf_query_multi、protobuf_to_json_text 和 protobuf_from_json_text。
上游警告不要接收不可信查询或未经验证的 protobuf 字节。大型或递归 map 密集消息可能在 PostgreSQL 普通内存核算之外消耗大量 C++ 堆;每次查询都会扫描消息,模式只缓存一个事务,依赖模式的查询函数也不能安全用作索引表达式。Proto3 缺失/默认字段不会返回结果,已弃用 group 不受支持,已复核实现仅测试 AMD64。应限制输入,在数据库外验证并重新序列化,限制描述符变更,并基准内存和延迟。