Until now, I saw several examples of orphaned records in base-tables, eg:
ProdUnitTable
has InventSiteID
, not existing in InventSite
( any more ), or
ProdRoute
has WrkCtrId
, not existing in WrkCtrTable
( any more ), leading to unintended behaviour.
Is this just buggy, or is there any way to check integrity of present data in base tables? Some of those bugs seem to exist in Contoso-Demo-Data.
There is a way to check the integrity of the data. It is the Consistency Check tool found at Basic -> Periodic -> Consistency check.
Select the modules you want to check, make sure "Check" is selected, and click OK. The consistency check will run validate methods to check the EDTs and tables related to the modules you selected. The result will be an infolog of warnings showing you what data is inconsistent. It will find each record that might be a case of what you mentioned in your question.
A word of caution: if you select the "Fix" option, it will fix the inconsistencies. However, this might cause other problems with your data. I would suggest only running "Check" and then fixing the problems yourself through code or manual changes.