diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-06-19 20:07:08 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-06-19 20:07:33 -0400 |
commit | cfa0f4255bb0f5550d37a01c4d8fe2966d20040c (patch) | |
tree | 8dc72f8c53b3c5eeed79bf566487cd95216331ac /src/include/commands/trigger.h | |
parent | afe1c51c9d65c67c7474c60d64bceefe9953dde6 (diff) | |
download | postgresql-cfa0f4255bb0f5550d37a01c4d8fe2966d20040c.tar.gz postgresql-cfa0f4255bb0f5550d37a01c4d8fe2966d20040c.zip |
Improve tests for whether we can skip queueing RI enforcement triggers.
During an update of a PK row, we can skip firing the RI trigger if any old
key value is NULL, because then the row could not have had any matching
rows in the FK table. Conversely, during an update of an FK row, the
outcome is determined if any new key value is NULL. In either case it
becomes unnecessary to compare individual key values.
This patch was inspired by discussion of Vik Reykja's patch to use IS NOT
DISTINCT semantics for the key comparisons. In the event there is no need
for that and so this patch looks nothing like his, but he should still get
credit for having re-opened consideration of the trigger skip logic.
Diffstat (limited to 'src/include/commands/trigger.h')
-rw-r--r-- | src/include/commands/trigger.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h index 93033414d91..e790b9d3009 100644 --- a/src/include/commands/trigger.h +++ b/src/include/commands/trigger.h @@ -191,10 +191,10 @@ extern bool AfterTriggerPendingOnRel(Oid relid); /* * in utils/adt/ri_triggers.c */ -extern bool RI_FKey_keyequal_upd_pk(Trigger *trigger, Relation pk_rel, - HeapTuple old_row, HeapTuple new_row); -extern bool RI_FKey_keyequal_upd_fk(Trigger *trigger, Relation fk_rel, - HeapTuple old_row, HeapTuple new_row); +extern bool RI_FKey_pk_upd_check_required(Trigger *trigger, Relation pk_rel, + HeapTuple old_row, HeapTuple new_row); +extern bool RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel, + HeapTuple old_row, HeapTuple new_row); extern bool RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel); |