79 (
errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
80 errmsg(
"triggered_change_notification: must be called as trigger")));
85 (
errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
86 errmsg(
"triggered_change_notification: must be called after the change")));
91 (
errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
92 errmsg(
"triggered_change_notification: must be called for each row")));
102 elog(
ERROR,
"triggered_change_notification: trigger fired by unrecognized operation");
110 (
errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
111 errmsg(
"triggered_change_notification: must not be called with more than one parameter")));
116 channel = trigger->tgargs[0];
132 foreach(indexoidscan, indexoidlist)
140 elog(
ERROR,
"cache lookup failed for index %u", indexoid);
145 int indnkeyatts =
index->indnkeyatts;
157 for (
i = 0;
i < indnkeyatts;
i++)
159 int colno =
index->indkey.values[
i];
180 (
errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
181 errmsg(
"triggered_change_notification: must be called on a table with a primary key")));
void Async_Notify(const char *channel, const char *payload)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void list_free(List *list)
FormData_pg_attribute * Form_pg_attribute
FormData_pg_index * Form_pg_index
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
#define RelationGetRelationName(relation)
List * RelationGetIndexList(Relation relation)
char * SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
void initStringInfo(StringInfo str)
#define appendStringInfoCharMacro(str, ch)
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
static void strcpy_quoted(StringInfo r, const char *s, const char q)
Datum triggered_change_notification(PG_FUNCTION_ARGS)
PG_MODULE_MAGIC_EXT(.name="tcn",.version=PG_VERSION)
PG_FUNCTION_INFO_V1(triggered_change_notification)
#define TRIGGER_FIRED_BY_DELETE(event)
#define CALLED_AS_TRIGGER(fcinfo)
#define TRIGGER_FIRED_FOR_ROW(event)
#define TRIGGER_FIRED_AFTER(event)
#define TRIGGER_FIRED_BY_INSERT(event)
#define TRIGGER_FIRED_BY_UPDATE(event)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)