News for hackers. Stuff that matters.
Re:We do not use foreign keys (2016) by vbezhenar on Friday November 08, 2019 @04:50PM (#21487206)
Is it even possible to realistically do FK checks in app code? Nobody uses serializable transactions and with other isolation levels I think it's possible to check for FK, it's OK now, insert new row, but another transaction simultaneously deletes that row and both transactions happily commit. It's called phantom read. Probably it's very rare event, but it'll happen.
Re:We do not use foreign keys (2016) by mumblemumble on Friday November 08, 2019 @06:03PM (#21487836)
At the place I worked that skipped FK checks, they used append-only database schemata. If you limit yourself to CR operations, a lot of things get easier than they are with CRUD - ensuring (a somewhat weak form of) database consistency without transactions, yeah, but also things like audit trails and slurping new data into the BI system.