@@ -2227,12 +2227,16 @@ RI_FKey_setdefault_del(PG_FUNCTION_ARGS)
2227
2227
heap_close (fk_rel , RowExclusiveLock );
2228
2228
2229
2229
/*
2230
- * In the case we delete the row who's key is equal to the default
2231
- * values AND a referencing row in the foreign key table exists,
2232
- * we would just have updated it to the same values. We need to do
2233
- * another lookup now and in case a reference exists, abort the
2234
- * operation. That is already implemented in the NO ACTION
2235
- * trigger.
2230
+ * If we just deleted the PK row whose key was equal to the FK
2231
+ * columns' default values, and a referencing row exists in the FK
2232
+ * table, we would have updated that row to the same values it
2233
+ * already had --- and RI_FKey_keyequal_upd_fk would therefore
2234
+ * believe no check is necessary. So we need to do another lookup
2235
+ * now and in case a reference still exists, abort the operation.
2236
+ * That is already implemented in the NO ACTION trigger, so just
2237
+ * run it. (This recheck is only needed in the SET DEFAULT case,
2238
+ * since CASCADE would remove such rows, while SET NULL is certain
2239
+ * to result in rows that satisfy the FK constraint.)
2236
2240
*/
2237
2241
RI_FKey_noaction_del (fcinfo );
2238
2242
@@ -2420,12 +2424,16 @@ RI_FKey_setdefault_upd(PG_FUNCTION_ARGS)
2420
2424
heap_close (fk_rel , RowExclusiveLock );
2421
2425
2422
2426
/*
2423
- * In the case we updated the row who's key was equal to the
2424
- * default values AND a referencing row in the foreign key table
2425
- * exists, we would just have updated it to the same values. We
2426
- * need to do another lookup now and in case a reference exists,
2427
- * abort the operation. That is already implemented in the NO
2428
- * ACTION trigger.
2427
+ * If we just updated the PK row whose key was equal to the FK
2428
+ * columns' default values, and a referencing row exists in the FK
2429
+ * table, we would have updated that row to the same values it
2430
+ * already had --- and RI_FKey_keyequal_upd_fk would therefore
2431
+ * believe no check is necessary. So we need to do another lookup
2432
+ * now and in case a reference still exists, abort the operation.
2433
+ * That is already implemented in the NO ACTION trigger, so just
2434
+ * run it. (This recheck is only needed in the SET DEFAULT case,
2435
+ * since CASCADE must change the FK key values, while SET NULL is
2436
+ * certain to result in rows that satisfy the FK constraint.)
2429
2437
*/
2430
2438
RI_FKey_noaction_upd (fcinfo );
2431
2439
0 commit comments