pglinter
PG数据库规则检查插件
pglinter · PG数据库规则检查插件
概览
| ID | 扩展 | 软件包 | 版本 | 类别 | 许可证 | 编程语言 |
|---|---|---|---|---|---|---|
| 5090 | pglinter | pglinter | 2.0.0 | ADMIN | Apache-2.0 | Rust |
| 属性 | 可执行文件 | 动态库 | 需要预加载 | 需要建扩展 | 可迁移 | 可信 |
|---|---|---|---|---|---|---|
| --s-dt- | 否 | 是 | 否 | 是 | 否 | 是 |
| 关联 | |
|---|---|
| 相关扩展 | plpgsql_check pg_query_rewrite ddlx pg_readme pldbgapi pg_fsql pgdd meta plprofiler pg_stat_plans |
软件包
| Linux / PG | PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|---|
| el8.x86_64 | N/A | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| el8.aarch64 | N/A | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| el9.x86_64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| el9.aarch64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| el10.x86_64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| el10.aarch64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| d12.x86_64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| d12.aarch64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| d13.x86_64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| d13.aarch64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| u22.x86_64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| u22.aarch64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| u24.x86_64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| u24.aarch64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| u26.x86_64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
| u26.aarch64 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 | PIGSTY 2.0.0 |
源码
安装
在数据库中创建扩展。
用法
来源:README、how-to、examples、rules、2.0.0 release
pglinter 会分析 PostgreSQL 数据库中的潜在问题、性能问题和最佳实践违规。当前用户文档通过 pglinter.get_violations() 暴露检查结果,该函数返回已启用规则的违规行,可过滤,也可连接到 pg_identify_object()。
运行检查
规则管理
规则导入与导出
规则家族
基础规则(B 系列): B001 表缺少主键、B002 冗余索引、B003 外键缺少索引、B004 未使用的索引、B005 大写名称、B006 未使用的表、B007 跨模式外键、B008 外键类型不匹配、B009 共享触发器函数、B010 使用保留关键字、B011 单个模式存在多个所有者、B012 复合主键超过四列、B013 触发器逐行处理且没有 WHERE 子句。
集群规则(C 系列): C002 不安全的 pg_hba.conf 条目、C003 使用 MD5 密码加密。
模式规则(S 系列): S001 未设置默认角色授权、S002 名称带环境前缀或后缀、S003 public 模式未加固、S004 对象归系统角色所有、S005 单个模式存在多个所有者。
注意事项
版本 2.0.0 移除了较旧的 check() 和 check_rule() 函数;get_violations() 现在是唯一的检查 API。当前构建使用 pgrx 0.18.1。
上游 1.1.2 版本增加了 B013。主 README 相比其他文档和导出函数仍有部分滞后,因此本文使用 get_violations(),并省略已移除的 check() / check_rule() 示例。