What I think is if a column is not nullable the default value is empty/0/false depending on the type, if a column is nullable the default value is null.
Even null is simply a default value! Now why assign a default null value to a not nullable column?
to my knowledge, there’s not a database around that assigns empty/0/false to not nullable columns by default, because the default values are very “business rule” specific.
When creating/duplicating a record in a database, you get a completely empty record, except for the columns that have default values. It’s then up to the developer to assign all the proper values.
If Servoy would implement this differently, it would not stick to the “standard”. offcourse, in some cases, it would ba handy, but in many cases, I prefer the current logic, becaus eit makes you aware of the fact that there are columns where you have to pay attention to the values you put in.
As for null being a default value: Null is not a value, it’s nothing, it’s undefined.
As to why assign null to a not nullable column: well, as I said, it’s the default way of I think all DB’s, and from a programming perspective: normally, just a duplicate record is not the end of the action. normally, you start to adjust some of the values afterwards.
And now that I’ve written all this, I think: But, if you duplicate an existing record, shouldn’t all the columns have a proper value (as in not being null)? Are you saying some data gets lost when duplicating an existing record? Or did the existing record somehow get into the DB with null values for not nullable columns? (the latter can happen is the not nullable constraint is added later (not every DB allows for this thought))
Paul