← 返回
未分类 中文

Postgres Code Review

Reviews PostgreSQL code for indexing strategies, JSONB operations, connection pooling, and transaction safety. Use when reviewing SQL queries, database schem...
审查 PostgreSQL 代码,关注索引策略、JSONB 操作、连接池和事务安全性。适用于审查 SQL 查询、数据库模式。
anderskev anderskev 来源
未分类 clawhub v1.1.1 2 版本 100000 Key: 无需
★ 1
Stars
📥 555
下载
💾 4
安装
2
版本
#latest

概述

PostgreSQL Code Review

Quick Reference

Issue TypeReference
-----------------------
Missing indexes, wrong index type, query performancereferences/indexes.md
JSONB queries, operators, GIN indexesreferences/jsonb.md
Connection leaks, pool configuration, timeoutsreferences/connections.md
Isolation levels, deadlocks, advisory locksreferences/transactions.md

Review Checklist

  • [ ] WHERE/JOIN columns have appropriate indexes
  • [ ] Composite indexes match query patterns (column order matters)
  • [ ] JSONB columns use GIN indexes when queried
  • [ ] Using proper JSONB operators (->, ->>, @>, ?)
  • [ ] Connection pool configured with appropriate limits
  • [ ] Connections properly released (context managers, try/finally)
  • [ ] Appropriate transaction isolation level for use case
  • [ ] No long-running transactions holding locks
  • [ ] Advisory locks used for application-level coordination
  • [ ] Queries use parameterized statements (no SQL injection)

Gates (before reporting findings)

Use this sequence so conclusions stay evidence-bound (not “I checked mentally”):

  1. Scope — Record the concrete paths (and line ranges or symbols if helpful) for the SQL, DDL/migrations, and connection code under review. Pass: every subsystem you critique (queries, JSONB, pool, transactions) has at least one cited path.
  2. SQL/DDL citation for performance claims — Index, sequential-scan, JSONB-operator, and plan-related findings must point to the exact statement or schema (quoted excerpt or file:line). Pass: each such finding includes that citation.
  3. Binding check before injection flags — Only assert SQL-injection risk after locating how SQL and values are combined (bound parameters vs string concat/format/f-strings). Pass: you name the mechanism you saw in code for each flagged callsite.

Then load the relevant reference doc from Quick Reference and walk the Review Checklist.

When to Load References

  • Reviewing SELECT queries with WHERE/JOIN → indexes.md
  • Reviewing JSONB columns or JSON operations → jsonb.md
  • Reviewing database connection code → connections.md
  • Reviewing BEGIN/COMMIT or concurrent updates → transactions.md

Review Questions

  1. Will this query use an index or perform a sequential scan?
  2. Are JSONB operations using appropriate operators and indexes?
  3. Are database connections properly managed and released?
  4. Is the transaction isolation level appropriate for this operation?
  5. Could this cause deadlocks or long-running locks?

版本历史

共 2 个版本

  • v1.1.1 当前
    2026-05-03 05:00 安全 安全
  • v1.1.0
    2026-03-30 22:47 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 78 📥 182,645
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 681 📥 329,993
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 197 📥 68,044