|
17 | 17 | *
|
18 | 18 | * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
19 | 19 | *
|
20 |
| - * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.50 2003/04/26 22:21:47 tgl Exp $ |
| 20 | + * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.51 2003/06/11 15:02:25 momjian Exp $ |
21 | 21 | *
|
22 | 22 | * ----------
|
23 | 23 | */
|
@@ -883,17 +883,6 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS)
|
883 | 883 | old_row = trigdata->tg_trigtuple;
|
884 | 884 |
|
885 | 885 | match_type = ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]);
|
886 |
| - if (ri_Check_Pk_Match(pk_rel, fk_rel, |
887 |
| - old_row, trigdata->tg_trigger->tgoid, |
888 |
| - match_type, tgnargs, tgargs)) |
889 |
| - { |
890 |
| - /* |
891 |
| - * There's either another row, or no row could match this one. In |
892 |
| - * either case, we don't need to do the check. |
893 |
| - */ |
894 |
| - heap_close(fk_rel, RowShareLock); |
895 |
| - return PointerGetDatum(NULL); |
896 |
| - } |
897 | 886 |
|
898 | 887 | switch (match_type)
|
899 | 888 | {
|
@@ -941,6 +930,18 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS)
|
941 | 930 | return PointerGetDatum(NULL);
|
942 | 931 | }
|
943 | 932 |
|
| 933 | + if (ri_Check_Pk_Match(pk_rel, fk_rel, |
| 934 | + old_row, trigdata->tg_trigger->tgoid, |
| 935 | + match_type, tgnargs, tgargs)) |
| 936 | + { |
| 937 | + /* |
| 938 | + * There's either another row, or no row could match this one. In |
| 939 | + * either case, we don't need to do the check. |
| 940 | + */ |
| 941 | + heap_close(fk_rel, RowShareLock); |
| 942 | + return PointerGetDatum(NULL); |
| 943 | + } |
| 944 | + |
944 | 945 | if (SPI_connect() != SPI_OK_CONNECT)
|
945 | 946 | elog(ERROR, "SPI_connect() failed in RI_FKey_noaction_upd()");
|
946 | 947 |
|
|
0 commit comments