Definition at line 22 of file autoinc.c.
23{
26 int nargs;
36 bool isnull;
38
40
41 elog(
ERROR,
"not fired by trigger manager");
43
46
47 elog(
ERROR,
"must be fired before event");
48
53 else
54
55 elog(
ERROR,
"cannot process DELETE events");
56
57 rel = trigdata->tg_relation;
59
61
63 if (nargs <= 0 || nargs % 2 != 0)
64
65 elog(
ERROR,
"autoinc (%s): even number gt 0 of arguments was expected",
relname);
66
69
73
74 for (
i = 0;
i < nargs;)
75 {
79
83 errmsg(
"\"%s\" has no attribute \"%s\"",
85
89 errmsg(
"attribute \"%s\" of \"%s\" must be type INT4",
91
93
94 if (!isnull &&
val != 0)
95 {
97 continue;
98 }
99
104
107 {
110 }
115 }
116
118 {
122 }
123
128
130}
#define CStringGetTextDatum(s)
Datum nextval(PG_FUNCTION_ARGS)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define DatumGetTextPP(X)
#define DirectFunctionCall1(func, arg1)
HeapTuple heap_modify_tuple_by_cols(HeapTuple tuple, TupleDesc tupleDesc, int nCols, const int *replCols, const Datum *replValues, const bool *replIsnull)
void pfree(void *pointer)
static int64 DatumGetInt64(Datum X)
static Datum PointerGetDatum(const void *X)
static Datum Int32GetDatum(int32 X)
static int32 DatumGetInt32(Datum X)
int SPI_fnumber(TupleDesc tupdesc, const char *fname)
Oid SPI_gettypeid(TupleDesc tupdesc, int fnumber)
Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull)
char * SPI_getrelname(Relation rel)
#define TRIGGER_FIRED_BEFORE(event)
#define CALLED_AS_TRIGGER(fcinfo)
#define TRIGGER_FIRED_FOR_ROW(event)
#define TRIGGER_FIRED_BY_INSERT(event)
#define TRIGGER_FIRED_BY_UPDATE(event)
References attnum, CALLED_AS_TRIGGER, CStringGetTextDatum, DatumGetInt32(), DatumGetInt64(), DatumGetTextPP, DirectFunctionCall1, elog, ereport, errcode(), errmsg(), ERROR, fb(), heap_modify_tuple_by_cols(), i, Int32GetDatum(), nextval(), palloc(), pfree(), PointerGetDatum(), RelationData::rd_att, relname, SPI_fnumber(), SPI_getbinval(), SPI_getrelname(), SPI_gettypeid(), TriggerData::tg_event, TriggerData::tg_newtuple, TriggerData::tg_relation, TriggerData::tg_trigger, TriggerData::tg_trigtuple, Trigger::tgnargs, TRIGGER_FIRED_BEFORE, TRIGGER_FIRED_BY_INSERT, TRIGGER_FIRED_BY_UPDATE, TRIGGER_FIRED_FOR_ROW, and val.