Are separate things.
The DEFAULT
just makes a auto Insert if the insertion does not have a value for that column, but nothing prevents you from applying a NULL
in it after that in another operation, if there is no clause NOT NULL
. Including in the INSERT
if you explicitly say that you want to place a NULL
, the DEFAULT
will not be considered and the null and void will be applied if this restriction is not defined.
So if you want to restrict nulls, write this in the modeling, don’t trust a transient operation. The DEFAULT
is only a facilitator, not a restrictor.
In fact I would think if it’s worth this idea that everything should be NULL
by default. I think it should be the other way around. Only when there are clear cases where the NULL
is useful is that it should be allowed. And it should rarely be useful.
It also depends on the application, if you can set the value to null it will not insert the default, will insert
null
.– Jéf Bueno