Amazon Aurora DSQL now supports foreign key constraints, filling a major compatibility gap for applications moving from conventional PostgreSQL databases. Developers can enforce relationships between tables and use actions including CASCADE and SET NULL rather than maintaining those rules entirely in application code.

The distributed service verifies relationships against a consistent transaction snapshot and detects conflicting changes at commit time using PostgreSQL’s KEY SHARE mechanism. It does not lock tables while checking. A transaction that would violate the constraint or conflicts with a concurrent update fails with a serialization error, so applications must implement retry logic.

AWS recommends keeping heavily referenced key columns stable and moving frequently changing values into non-key fields. It also warns that writes involving referenced or referencing tables require extra reads, meaning teams should benchmark their workload before adding constraints broadly. Users had repeatedly cited the absence of foreign keys as a blocker for migrations, especially for existing applications that rely on database-enforced integrity. The new feature makes those moves more practical, but it preserves Aurora DSQL’s optimistic concurrency trade-off: contention becomes a retry rather than a wait, and correctness checks carry a measurable cost.