Your database
Code quality
Stability
Security & compliance
Table has no primary key
Part of the Schema & indexes check · fix arrives as a guide
What it is
A table has no primary key.
Why it matters
There is no reliable way to address a single row, so a duplicate cannot be deduplicated and an update can silently affect more rows than intended. Logical replication also refuses to replicate updates and deletes on such a table.
How to fix it
Add a primary key on the natural key if one exists, or an identity column if not. Where duplicates already exist, deduplicate before adding the constraint.
Run them all on your app
Connect your repo and your live services with read-only scopes. The first scan is free, and nothing changes without your approval.