PostgreSQL constraints, triggers and vector search

Most PostgreSQL problems in this pool are not query tuning. They are write-path bugs: a trigger that fires during a cascading delete, an approval that commits before the index job exists, a similarity score that leaves the float32 range and trips a CHECK constraint. Each blueprint names the exact failure, shows the schema or statement that causes it, and gives the smallest change that fixes it — usually one condition in a trigger, one column in a constraint, or one clamp before an INSERT. Everything here was written from a reproducible setup, not from a forum thread, and the entries stay short on purpose: one problem, one cause, one fix.

Triggers and constraints

Migrations and indexing

Other topics: Home Assistant: entities, automations and device states · Docker Compose: startup, networking and configuration