|
| 1 | +/* ---------- |
| 2 | + * ri_triggers.c |
| 3 | + * |
| 4 | + * Generic trigger procedures for referential integrity constraint |
| 5 | + * checks. |
| 6 | + * |
| 7 | + * 1999 Jan Wieck |
| 8 | + * |
| 9 | + * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.1 1999/09/30 14:54:22 wieck Exp $ |
| 10 | + * |
| 11 | + * ---------- |
| 12 | + */ |
| 13 | + |
| 14 | +#include "postgres.h" |
| 15 | +#include "fmgr.h" |
| 16 | + |
| 17 | +#include "access/heapam.h" |
| 18 | +#include "catalog/pg_proc.h" |
| 19 | +#include "catalog/pg_type.h" |
| 20 | +#include "commands/trigger.h" |
| 21 | +#include "executor/spi.h" |
| 22 | +#include "utils/builtins.h" |
| 23 | +#include "utils/syscache.h" |
| 24 | + |
| 25 | +/* ---------- |
| 26 | + * RI_FKey_check_ins - |
| 27 | + * |
| 28 | + * Check foreign key existance at insert event on FK table. |
| 29 | + * ---------- |
| 30 | + */ |
| 31 | +HeapTuple |
| 32 | +RI_FKey_check_ins (FmgrInfo *proinfo) |
| 33 | +{ |
| 34 | + CurrentTriggerData = NULL; |
| 35 | + |
| 36 | + elog(NOTICE, "RI_FKey_check_ins() called\n"); |
| 37 | + return NULL; |
| 38 | +} |
| 39 | + |
| 40 | + |
| 41 | +/* ---------- |
| 42 | + * RI_FKey_check_upd - |
| 43 | + * |
| 44 | + * Check foreign key existance at update event on FK table. |
| 45 | + * ---------- |
| 46 | + */ |
| 47 | +HeapTuple |
| 48 | +RI_FKey_check_upd (FmgrInfo *proinfo) |
| 49 | +{ |
| 50 | + CurrentTriggerData = NULL; |
| 51 | + |
| 52 | + elog(NOTICE, "RI_FKey_check_upd() called\n"); |
| 53 | + return NULL; |
| 54 | +} |
| 55 | + |
| 56 | + |
| 57 | +/* ---------- |
| 58 | + * RI_FKey_cascade_del - |
| 59 | + * |
| 60 | + * Cascaded delete foreign key references at delete event on PK table. |
| 61 | + * ---------- |
| 62 | + */ |
| 63 | +HeapTuple |
| 64 | +RI_FKey_cascade_del (FmgrInfo *proinfo) |
| 65 | +{ |
| 66 | + CurrentTriggerData = NULL; |
| 67 | + |
| 68 | + elog(NOTICE, "RI_FKey_cascade_del() called\n"); |
| 69 | + return NULL; |
| 70 | +} |
| 71 | + |
| 72 | + |
| 73 | +/* ---------- |
| 74 | + * RI_FKey_cascade_upd - |
| 75 | + * |
| 76 | + * Cascaded update/delete foreign key references at update event on PK table. |
| 77 | + * ---------- |
| 78 | + */ |
| 79 | +HeapTuple |
| 80 | +RI_FKey_cascade_upd (FmgrInfo *proinfo) |
| 81 | +{ |
| 82 | + CurrentTriggerData = NULL; |
| 83 | + |
| 84 | + elog(NOTICE, "RI_FKey_cascade_upd() called\n"); |
| 85 | + return NULL; |
| 86 | +} |
| 87 | + |
| 88 | + |
| 89 | +/* ---------- |
| 90 | + * RI_FKey_restrict_del - |
| 91 | + * |
| 92 | + * Restrict delete from PK table to rows unreferenced by foreign key. |
| 93 | + * ---------- |
| 94 | + */ |
| 95 | +HeapTuple |
| 96 | +RI_FKey_restrict_del (FmgrInfo *proinfo) |
| 97 | +{ |
| 98 | + CurrentTriggerData = NULL; |
| 99 | + |
| 100 | + elog(NOTICE, "RI_FKey_restrict_del() called\n"); |
| 101 | + return NULL; |
| 102 | +} |
| 103 | + |
| 104 | + |
| 105 | +/* ---------- |
| 106 | + * RI_FKey_restrict_upd - |
| 107 | + * |
| 108 | + * Restrict update of PK to rows unreferenced by foreign key. |
| 109 | + * ---------- |
| 110 | + */ |
| 111 | +HeapTuple |
| 112 | +RI_FKey_restrict_upd (FmgrInfo *proinfo) |
| 113 | +{ |
| 114 | + CurrentTriggerData = NULL; |
| 115 | + |
| 116 | + elog(NOTICE, "RI_FKey_restrict_upd() called\n"); |
| 117 | + return NULL; |
| 118 | +} |
| 119 | + |
| 120 | + |
| 121 | +/* ---------- |
| 122 | + * RI_FKey_setnull_del - |
| 123 | + * |
| 124 | + * Set foreign key references to NULL values at delete event on PK table. |
| 125 | + * ---------- |
| 126 | + */ |
| 127 | +HeapTuple |
| 128 | +RI_FKey_setnull_del (FmgrInfo *proinfo) |
| 129 | +{ |
| 130 | + CurrentTriggerData = NULL; |
| 131 | + |
| 132 | + elog(NOTICE, "RI_FKey_setnull_del() called\n"); |
| 133 | + return NULL; |
| 134 | +} |
| 135 | + |
| 136 | + |
| 137 | +/* ---------- |
| 138 | + * RI_FKey_setnull_upd - |
| 139 | + * |
| 140 | + * Set foreign key references to NULL at update event on PK table. |
| 141 | + * ---------- |
| 142 | + */ |
| 143 | +HeapTuple |
| 144 | +RI_FKey_setnull_upd (FmgrInfo *proinfo) |
| 145 | +{ |
| 146 | + CurrentTriggerData = NULL; |
| 147 | + |
| 148 | + elog(NOTICE, "RI_FKey_setnull_upd() called\n"); |
| 149 | + return NULL; |
| 150 | +} |
| 151 | + |
| 152 | + |
| 153 | +/* ---------- |
| 154 | + * RI_FKey_setdefault_del - |
| 155 | + * |
| 156 | + * Set foreign key references to defaults at delete event on PK table. |
| 157 | + * ---------- |
| 158 | + */ |
| 159 | +HeapTuple |
| 160 | +RI_FKey_setdefault_del (FmgrInfo *proinfo) |
| 161 | +{ |
| 162 | + CurrentTriggerData = NULL; |
| 163 | + |
| 164 | + elog(NOTICE, "RI_FKey_setdefault_del() called\n"); |
| 165 | + return NULL; |
| 166 | +} |
| 167 | + |
| 168 | + |
| 169 | +/* ---------- |
| 170 | + * RI_FKey_setdefault_upd - |
| 171 | + * |
| 172 | + * Set foreign key references to defaults at update event on PK table. |
| 173 | + * ---------- |
| 174 | + */ |
| 175 | +HeapTuple |
| 176 | +RI_FKey_setdefault_upd (FmgrInfo *proinfo) |
| 177 | +{ |
| 178 | + CurrentTriggerData = NULL; |
| 179 | + |
| 180 | + elog(NOTICE, "RI_FKey_setdefault_upd() called\n"); |
| 181 | + return NULL; |
| 182 | +} |
| 183 | + |
| 184 | + |
0 commit comments