Use NOT VALID to enforce a not null constraint on file_store
When adding a constraint to a table, we can optionally include NOT VALID. This tells Postgres that it doesn’t need to enforce the constraint on existing records in the table. At least not immediately. This constraint will be enforced for any updates and subsequent insertions. Thus, we can immediately enforce the constraint while giving ourselves time to clean up any existing records that conflict with the constraint.
Showing
Please register or sign in to comment