Files
aevolution/docs/adr/0013-postgresql-client.md
T
2026-10-08 12:08:53 -04:00

36 lines
1.3 KiB
Markdown

[Reviewed]
# ADR-0013: PostgreSQL client boundary
## Status
Superseded for M7.2 by [ADR-0059](0059-postgresql-bootstrap.md), which adopts
direct libpq for bounded asynchronous I/O. Historical recommendation follows.
## 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).