2 ms·
I haven't used stored procedures yet, but even ON DELETE CASCADE is super convenient and I suspect somewhat underused by SQL scaredy cats.
by ahartmetz 4mo ago
I haven't used stored procedures yet, but even ON DELETE CASCADE is super convenient and I suspect somewhat underused by SQL scaredy cats.
- wavemode 4mo agoON DELETE CASCADE is horrendously unsafe unless you have full understanding of the entire data model - which is unlikely for the average employee within a large organization with a gigantic database. (And it's also rare to be permanently deleting data when working in such a context, so the convenience doesn't matter that much.)
- ahartmetz 4mo agoIt's in the context of "SQLite as local data storage for an application", and I am absolutely sure that entries in a cross-reference table make no sense anymore when one of the linked objects is gone, or entries in an auxiliary data table when the principal object is gone. I am not using ON DELETE CASCADE to be clever - the referenced data is genuinely required.
- lelanthran 4mo ago> I haven't used stored procedures yet, but even ON DELETE CASCADE is super convenient and I suspect somewhat underused by SQL scaredy cats. Sooner or later you are going to hit enter, wait a few seconds and say "oops!"
- sulam 4mo agoI think the stored procedure equivalent would be a "on delete, cascade these tombstones" -- both safer and cleaner.