Index: src/backend/utils/adt/ri_triggers.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/adt/ri_triggers.c,v retrieving revision 1.49 diff -c -r1.49 ri_triggers.c *** src/backend/utils/adt/ri_triggers.c 2003/04/07 20:30:38 1.49 --- src/backend/utils/adt/ri_triggers.c 2003/04/09 23:39:47 *************** *** 892,908 **** old_row = trigdata->tg_trigtuple; match_type = ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]); - if (ri_Check_Pk_Match(pk_rel, fk_rel, - old_row, trigdata->tg_trigger->tgoid, - match_type, tgnargs, tgargs)) - { - /* - * There's either another row, or no row could match this one. In - * either case, we don't need to do the check. - */ - heap_close(fk_rel, RowShareLock); - return PointerGetDatum(NULL); - } switch (match_type) { --- 892,897 ---- *************** *** 946,951 **** --- 935,952 ---- if (ri_KeysEqual(pk_rel, old_row, new_row, &qkey, RI_KEYPAIR_PK_IDX)) { + heap_close(fk_rel, RowShareLock); + return PointerGetDatum(NULL); + } + + if (ri_Check_Pk_Match(pk_rel, fk_rel, + old_row, trigdata->tg_trigger->tgoid, + match_type, tgnargs, tgargs)) + { + /* + * There's either another row, or no row could match this one. In + * either case, we don't need to do the check. + */ heap_close(fk_rel, RowShareLock); return PointerGetDatum(NULL); }