Congratulations, you have reinvented the integrity constraint! Except IBM have been working on this for 40 years, making it reliable and performant. I have yet to see anyone roll their own data integrity layer that comes anywhere close to the major vendors.