- Is a read-only Postgres role enough to let an AI agent query my database safely?
- It's a start, but on its own it's leaky: a 'read-only' check enforced in app code is one SQL-comment trick from a write, a valid join can still expose a credentials column, and one heavy query can exhaust your connection pool. nlqdb layers engine-level guards — a fail-closed three-stage SQL validator plus Postgres row-level security — instead of trusting a single role or a single regex.
- How does nlqdb stop an agent from running a destructive or injected query?
- Writes never use agent-authored SQL — `nlqdb_remember` builds a parameterised INSERT server-side from a fixed column allow-list. Read SQL passes three independent stages (a leading-verb gate, a `node-sql-parser` AST parse, and an embedded-verb/function walk) and fails closed, so a CTE-hidden DROP, a `pg_sleep`, or an unparseable statement is rejected before it runs.
- Can I see exactly what SQL the agent ran?
- Always — every answer returns the result rows plus the compiled SQL under a trace toggle, and any destructive operation shows a row-count diff that needs a second confirmation before it applies. The SQL is the audit surface; nlqdb never hides it behind the answer.
- Can I point nlqdb at my existing production database to make it agent-safe?
- You can connect an existing database (the signed-in BYO connect verb), but that doesn't make it agent-safe — the server-built writes and per-tenant RLS on this page apply to databases nlqdb provisions, not one you connect. On a connected prod DB, scope a least-privilege role; for hard isolation, a read replica plus the validated read path is the safer shape.