|
18 | 18 | * Portions Copyright (c) 2000-2001, PostgreSQL Global Development Group |
19 | 19 | * Copyright 1999 Jan Wieck |
20 | 20 | * |
21 | | - * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.32 2002/03/06 06:10:14 momjian Exp $ |
| 21 | + * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.33 2002/03/19 02:57:15 momjian Exp $ |
22 | 22 | * |
23 | 23 | * ---------- |
24 | 24 | */ |
@@ -208,6 +208,17 @@ RI_FKey_check(PG_FUNCTION_ARGS) |
208 | 208 | new_row=trigdata->tg_trigtuple; |
209 | 209 | } |
210 | 210 |
|
| 211 | +/* |
| 212 | + * We should not even consider checking the row if it is no longer |
| 213 | + * valid since it was either deleted (doesn't matter) or updated |
| 214 | + * (in which case it'll be checked with its final values). |
| 215 | + */ |
| 216 | +if (new_row) { |
| 217 | +if (!HeapTupleSatisfiesItself(new_row->t_data)) { |
| 218 | +returnPointerGetDatum(NULL); |
| 219 | + } |
| 220 | + } |
| 221 | + |
211 | 222 | /* ---------- |
212 | 223 | * SQL3 11.9 <referential constraint definition> |
213 | 224 | *Gereral rules 2) a): |
|