Hacker News new | ask | show | jobs
by tuatoru 1388 days ago
Yes, just have columns for all the primary key fields of the referred-to table in the dependent table.

Then it's up to all your apps to guarantee that they fill those fields in correctly, and do the reference check when inserting or updating rows in the dependent table.

You also need to write checking programs that report foreign key errors on a timetable that suits (every minute, every hour, every day, whattever).

Report the errors to someone who understands the significance of them, and can fix them.