Constraints

Work In Progress

Before Postgres insert data, it follow rules we defined: Constraints. There are many constraints in Postgres:

A very common use case is to use CHECK constraint to enforce NOT NULL.

Setting NOT NULL on an existing column will block all reads and writes until every row is checked.

Add a CHECK constraint but not validate first.
Validate the constraint.
Then add the NOT NULL.
Remove the CHECK constraint.