forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2fb7560
committed
Doc: document that triggers can break referential integrity.
User-written triggers can modify or block the effects of SQL updateand delete operations. That includes operations that are executedto implement foreign keys' referential integrity actions (such asON UPDATE SET NULL or ON DELETE CASCADE). Therefore it's possiblefor a misdesigned trigger to result in a database state that violatesthe foreign key constraint.While this isn't great, the alternatives seem worse: in particular,refusing to fire triggers for such updates would break many valuableuse-cases. We could also try to recheck the constraint after theaction, but that'd roughly double the already-high cost of FKconstraint enforcement, for no benefit in normal cases. So we'vealways considered that it's on the trigger programmer's head toavoid breaking RI actions. This was never documented anywhere,though. Add a para to the Triggers chapter to explain it.Laurenz Albe, David Johnston, Tom LaneDiscussion:https://postgr.es/m/b81fe38fcc25a81be6e2e5b3fc1ff624130762fa.camel@cybertec.at1 parent482e108 commit2fb7560
1 file changed
+11
-0
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
354 | 354 |
| |
355 | 355 |
| |
356 | 356 |
| |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
357 | 368 |
| |
358 | 369 |
| |
359 | 370 |
| |
|
0 commit comments
Comments
(0)