# ADR-0013: PostgreSQL client boundary ## Status Proposed for M7; no database dependency in proof. PostgreSQL preference follows brief. ## Context Persistence needs transactions, fencing, migrations and outbox; ticks must not call the database. ## Decision Recommend libpqxx inside persistence adapters, I/O-executor connection ownership and typed errors. Prototype rollback, parameterized SQL, deadlines, ambiguous reconnect and bounded pools. ## Alternatives Considered Direct libpq offers C ABI/async control with more RAII/result conversion. ORM introduces unneeded mapping. libpqxx adds C++ transaction ergonomics and exception translation. ## Benefits Transactional concerns isolated from biology. ## Costs Client/runtime deployment, pinning, pooling and integration tests. ## Risks Ambiguous commit, blocked requests, injection, retry duplication and schema mismatch. ## Consequences Parameterized SQL; unique constraints/idempotency for retries. Timeout does not prove rollback. Inject failure after commit before ACK. Pin supported PostgreSQL/libpqxx pair and measure throughput/size. [libpqxx BSD-3-Clause](https://github.com/jtv/libpqxx), [libpq](https://www.postgresql.org/docs/current/libpq.html).