SQLite PRIMARY KEY columns can contain NULL values, violating SQL standard

4/10 Low

SQLite allows NULL values in PRIMARY KEY columns due to a historical bug that was not fixed to maintain backwards compatibility with existing databases. This violates standard SQL semantics and can lead to data integrity issues if developers are not aware of this quirk.

Category
compatibility
Workaround
solid
Stage
onboarding
Freshness
persistent
Scope
single_lib
Upstream
wontfix
Recurring
No
Maintainer
active

Sources

Collection History

Query: “What are the most common pain points with SQLite for developers in 2025?4/5/2026

PRIMARY KEYs Can Sometimes Contain NULLs... Due to an historical oversight, the column values of a PRIMARY KEY are allowed to be NULL. This is a bug, but by the time the problem was discovered there where so many databases in circulation that depended on the bug that the decision was made to support the buggy behavior moving forward.

Created: 4/5/2026Updated: 4/5/2026