cat_tools
用于操作 PostgreSQL 系统目录的工具集
cat_tools · 用于操作 PostgreSQL 系统目录的工具集
概览
| 属性 | 可执行文件 | 动态库 | 需要预加载 | 需要建扩展 | 可迁移 | 可信 |
|---|---|---|---|---|---|---|
| ----d-- | 否 | 否 | 否 | 是 | 否 | 否 |
| 关联 | |
|---|---|
| 模式 | cat_tools |
| 依赖 | plpgsql |
| 相关扩展 | pg_catcheck pgdd ddlx meta |
SQL-only catalog utilities; fixed schema cat_tools; requires plpgsql.
软件包
| Linux / PG | PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|---|
| el8.x86_64 | N/A | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| el8.aarch64 | N/A | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| el9.x86_64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| el9.aarch64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| el10.x86_64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| el10.aarch64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| d12.x86_64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| d12.aarch64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| d13.x86_64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| d13.aarch64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| u22.x86_64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| u22.aarch64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| u24.x86_64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| u24.aarch64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| u26.x86_64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
| u26.aarch64 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 | PIGSTY 0.4.0 |
源码
安装
在数据库中创建扩展。
用法
来源:
cat_tools 提供用于 PostgreSQL 目录自省的带类型视图、枚举和辅助函数。它面向需要比反复解析原始 pg_catalog 字段更稳定、更易读接口的数据库代码;这些视图仍会跟随 PostgreSQL 目录变化,因此每次跨大版本升级时都必须审查。
安装并授予访问权限
扩展安装在固定的 cat_tools 模式中,要求 plpgsql,且不可重定位。应授予 cat_tools__usage 角色,而不是直接暴露内部 _cat_tools 辅助对象。
检查关系与列
常用的关系辅助函数包括 pg_class(regclass)、relation__is_catalog、relation__is_temp、relation__kind 和 relation__relkind。带类型的映射函数能明确表示目录中的单字符代码。
检查例程
版本 0.3 新增了同时覆盖函数和过程的函数与类型:
例程接口包括 routine__parse_arg_types、routine__parse_arg_names、routine__arg_types、routine__arg_names、它们的文本变体,以及用于例程种类、参数模式、易变性和并行安全性的映射。function__arg_types 与 function__arg_types_text 已弃用;请改用例程解析器。
版本 0.3.0 与注意事项
- 上游版本 0.3.0 支持 PostgreSQL 12-18+;当前 Pigsty 软件包覆盖 PostgreSQL 15–19。
- 该版本修正了复合类型、外部表和物化视图对应的
c、f、m映射。任何曾绕过旧映射问题的代码都应重新测试。 - 内部
_cat_tools辅助对象现在会撤销PUBLIC的EXECUTE;调用者应继承cat_tools__usage并使用受支持的接口。 - 从 0.2.3 更新至 0.3.0 会新增枚举值,因此无法在 PostgreSQL 11 或更早版本上运行。请按照上游文档规定的顺序升级数据库大版本和扩展。
- PostgreSQL 不承诺跨大版本的目录兼容性。即使使用这些包装器,也应针对每个受支持的 PostgreSQL 大版本固定测试。