29{
32 oldtuple,
33 rettuple;
35 oldheader;
36
37 /* make sure it's called as a trigger */
40 (
errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
41 errmsg(
"suppress_redundant_updates_trigger: must be called as trigger")));
42
43 /* and that it's called on update */
46 (
errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
47 errmsg(
"suppress_redundant_updates_trigger: must be called on update")));
48
49 /* and that it's called before update */
52 (
errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
53 errmsg(
"suppress_redundant_updates_trigger: must be called before update")));
54
55 /* and that it's called for each row */
58 (
errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
59 errmsg(
"suppress_redundant_updates_trigger: must be called for each row")));
60
61 /* get tuple data, set default result */
64
65 newheader = newtuple->
t_data;
66 oldheader = oldtuple->t_data;
67
68 /* if the tuple payload is the same ... */
69 if (newtuple->
t_len == oldtuple->t_len &&
70 newheader->t_hoff == oldheader->t_hoff &&
73 ((newheader->t_infomask & ~HEAP_XACT_MASK) ==
78 {
79 /* ... then suppress the update */
80 rettuple = NULL;
81 }
82
84}
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define HeapTupleHeaderGetNatts(tup)
#define SizeofHeapTupleHeader
if(TABLE==NULL||TABLE_index==NULL)
static Datum PointerGetDatum(const void *X)
#define TRIGGER_FIRED_BEFORE(event)
#define CALLED_AS_TRIGGER(fcinfo)
#define TRIGGER_FIRED_FOR_ROW(event)
#define TRIGGER_FIRED_BY_UPDATE(event)