28{
30 int attnum;
/* attribute number to monitor */
31 char **
args;
/* Args containing attr name */
33 HeapTuple rettuple;
/* Tuple to be returned */
34 bool isdelete; /* are we deleting? */
35 HeapTuple newtuple;
/* The new value for tuple */
36 HeapTuple trigtuple;
/* The original value of tuple */
37
39 elog(
ERROR,
"lo_manage: not fired by trigger manager");
40
44
45 /*
46 * Fetch some values from trigdata
47 */
52
53 if (
args == NULL)
/* internal error */
54 elog(
ERROR,
"%s: no column name provided in the trigger definition",
56
57 /* tuple to return to Executor */
59 rettuple = newtuple;
60 else
61 rettuple = trigtuple;
62
63 /* Are we deleting the row? */
65
66 /* Get the column we're interested in */
68
70 elog(
ERROR,
"%s: column \"%s\" does not exist",
72
73 /*
74 * Handle updates
75 *
76 * Here, if the value of the monitored attribute changes, then the large
77 * object associated with the original value is unlinked.
78 */
79 if (newtuple != NULL &&
81 {
84
85 if (orig != NULL && (newv == NULL || strcmp(orig, newv) != 0))
88
89 if (newv)
91 if (orig)
93 }
94
95 /*
96 * Handle deleting of rows
97 *
98 * Here, we unlink the large object associated with the managed attribute
99 */
100 if (isdelete)
101 {
103
104 if (orig != NULL)
105 {
108
110 }
111 }
112
114}
Datum be_lo_unlink(PG_FUNCTION_ARGS)
bool bms_is_member(int x, const Bitmapset *a)
#define DirectFunctionCall1(func, arg1)
if(TABLE==NULL||TABLE_index==NULL)
void pfree(void *pointer)
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
int SPI_fnumber(TupleDesc tupdesc, const char *fname)
char * SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
const Bitmapset * tg_updatedcols
#define FirstLowInvalidHeapAttributeNumber
#define TRIGGER_FIRED_BY_DELETE(event)
#define CALLED_AS_TRIGGER(fcinfo)
#define TRIGGER_FIRED_FOR_ROW(event)
#define TRIGGER_FIRED_BY_UPDATE(event)