Notes on safer database work for AI agents.

Practical writing about disposable Postgres databases, migration validation, SQL checks, and keeping agent experiments away from shared development state.

Latest post

How to Test PostgreSQL LISTEN/NOTIFY Workflows

Prove registration, commit delivery, rollback silence, payload identity, duplicate folding, bounded waits, and disposable cleanup.

PostgresLISTEN NOTIFYintegration testingPsycopgcoding agents

How to Test PostgreSQL Materialized Views

Prove the installed definition, stale-data boundary, refresh behavior, concurrent-refresh prerequisites, exact results, and disposable cleanup.

How to Test PostgreSQL Partial Indexes

Prove the installed predicate, indexed row set, positive and negative plan paths, uniqueness behavior, data transitions, and disposable cleanup.

How to Test PostgreSQL Generated Columns

Prove the installed expression and storage kind, rejected direct writes, recomputation, trigger timing, version behavior, and disposable cleanup.

How to Test PostgreSQL Two-Phase Commit

Prove prepare-state invisibility, pg_prepared_xacts identity, cross-session commit and rollback, and zero remaining prepared transactions.

How to Test Postgres Advisory Locks Safely

Prove advisory-lock contention, session and transaction lifetime, catalog visibility, release, and cleanup with two real Postgres connections.

Per-Sandbox Postgres Roles for Coding Agents

Use one login role per disposable Postgres database, keep admin credentials out of task SQL, and understand exactly what the role boundary does and does not isolate.

Postgres Sandbox Quotas for Coding Agents

Set per-owner Postgres sandbox quotas that contain abandoned agent work without confusing database count, connection limits, TTLs, and cleanup.

How to Use Local Postgres Versions with Coding Agents

Use PGSandbox’s managed local versioned profiles to select specific PostgreSQL majors intentionally, avoid version-mismatch failures, and keep clone/migration validation predictable for coding agents.

How to Use Postgres EXPLAIN Plans for Agent SQL Review

Use Postgres EXPLAIN plans to review agent-generated SQL before execution: create a sandbox, inspect the JSON plan, check row estimates, then run bounded proof only when mutation is intentional.

What Is a Database Sandbox?

A database sandbox is an isolated database environment for testing changes, data states, and agent-generated SQL without mutating production or shared development state.

Database Branching vs Disposable Postgres Sandboxes

Database branching is great for preview environments and team workflows. Disposable Postgres sandboxes are better when a coding agent needs one task-scoped database it can safely prove work inside and throw away.