Can check_constraint/3 be used for not-null constraints?

I’m curious if check_constraint/3 can be used for not-null constraints. In Postgres a NOT NULL constraint is effectively a CHECK constraint.

If this is possible, how do you specify a name? When defining a NOT NULL constraint you don’t provide a name. Is there a default name created by Postgres?

1 Like