Read-only doesn't stop bloat: the hidden pitfalls of letting agents query Postgres
CreatorMarcusriv · reddit · 2026-10-27
A replica plus a read-only role remains the least-bad setup for letting AI agents query Postgres, but it protects less than expected:
- Read-only ≠ harmless: long queries on the replica hold snapshots; with hotstandbyfeedback on, the primary can't vacuum needed tuples and bloat builds. Cap the role itself: ALTER ROLE agent SET statementtimeout = '30s'
- Attribution: behind a pooler, pgaudit only sees the db role. Fix via applicationname with %a in loglineprefix, or per-agent short-lived db users (dynamic secrets engine or CREATE ROLE with VALID UNTIL + cleanup)
- Grants trap: ALTER DEFAULT PRIVILEGES only covers objects created by the named role; pgreadalldata exposes PII — prefer explicit grants on masked views
More from coding & agent
- Hyphenate raises $45M Series A as revenue grows 86x with autonomous finance agents — aakashgupta · 2026-10-27
- t3code vs latest Codex: dev says one feature — Astras spinning up Opus armies — wins — ludwigABAP · 2026-10-27
- OpenAI, Google, Anthropic Reportedly Building FINRA-Style AI Self-Regulator by 2027 — emmanuelvivier · 2026-10-27
- IBM Launches Verifiable Identity and Control for Enterprise AI Agents — emmanuelvivier · 2026-10-27
- One word in your prompt decides the language: 'easy' gets Python, 'fast' gets Rust — rseroter · 2026-10-27
- NewMax runs optimized Claude Code with BYOK keys, plus pool rotation and OAuth — yangyi · 2026-10-27