This question already has an answer here:
- Why shouldn't we allow NULLs? 8 answers
I am using PostgreSQL and trying to write value constraints.
Is it possible to record missing data as distinct from NULL values in a numeric field without using an arbitrary numeric value?
For many fields, I want to ensure that the record is either numeric or recorded as missing, but not NULL.
A common solution is to use -9999 to indicate a missing value. However, this can lead to silent errors (e.g. calculating a mean). Is there a better solution than creating a new type that allows either a value of "Missing" or a number?