23{
26 int nargs;
27 int *chattrs;
28 int chnattrs = 0;
30 bool *newnulls;
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
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
67 args = trigger->tgargs;
68 tupdesc = rel->rd_att;
69
70 chattrs = (
int *)
palloc(nargs / 2 *
sizeof(
int));
72 newnulls = (
bool *)
palloc(nargs / 2 *
sizeof(
bool));
73
74 for (
i = 0;
i < nargs;)
75 {
79
82 (
errcode(ERRCODE_TRIGGERED_ACTION_EXCEPTION),
83 errmsg(
"\"%s\" has no attribute \"%s\"",
85
88 (
errcode(ERRCODE_TRIGGERED_ACTION_EXCEPTION),
89 errmsg(
"attribute \"%s\" of \"%s\" must be type INT4",
91
93
94 if (!isnull &&
val != 0)
95 {
97 continue;
98 }
99
101 chattrs[chnattrs] =
attnum;
104
107 {
110 }
111 newnulls[chnattrs] = false;
113 chnattrs++;
115 }
116
117 if (chnattrs > 0)
118 {
120 chnattrs, chattrs,
121 newvals, newnulls);
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)
if(TABLE==NULL||TABLE_index==NULL)
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)