3 ms·
that have status='Loading' but which have started_loading_at=NULL, in violation of your data model Why not CHECK() it then? Or make ‘status’ GENERATED STORED o
by wruza 4y ago
that have status='Loading' but which have started_loading_at=NULL, in violation of your data model
Why not CHECK() it then? Or make ‘status’ GENERATED STORED or do a similar thing on triggers. The way that you suggested is also good, but it creates two names, one for update, another for select, which may confuse orms or developers.
- zarzavat 4y agoThe iron law of data is that there should be one source of truth. It’s always better to enforce constraints statically (in this case by the schema) than dynamically at runtime. Because avoiding inconsistencies is the human’s job, the computer sure as hell won’t know what to do about it.
- wruza 4y agoNot sure I understand a context for this, since checks and triggers are as static as views in a schema sense, and all of them are dynamic in a sense of computation (though get updated at different times). If you mean that columns/fields should not share parts of the same “fact” even if one of them is computed or both are constrained accordingly, then I disagree.
- deleted 4y ago[deleted]