47 elog(
ERROR,
"moddatetime: not fired by trigger manager");
51 elog(
ERROR,
"moddatetime: must be fired for row");
55 elog(
ERROR,
"moddatetime: must be fired before event");
59 elog(
ERROR,
"moddatetime: cannot process INSERT events");
64 elog(
ERROR,
"moddatetime: cannot process DELETE events");
77 args = trigger->tgargs;
79 tupdesc = rel->rd_att;
93 (
errcode(ERRCODE_TRIGGERED_ACTION_EXCEPTION),
94 errmsg(
"\"%s\" has no attribute \"%s\"",
102 if (atttypid == TIMESTAMPOID)
107 else if (atttypid == TIMESTAMPTZOID)
115 (
errcode(ERRCODE_TRIGGERED_ACTION_EXCEPTION),
116 errmsg(
"attribute \"%s\" of \"%s\" must be type TIMESTAMP or TIMESTAMPTZ",
124 1, &
attnum, &newdt, &newdtnull);
Datum timestamp_in(PG_FUNCTION_ARGS)
Datum timestamptz_in(PG_FUNCTION_ARGS)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define DirectFunctionCall3(func, arg1, arg2, arg3)
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)
PG_FUNCTION_INFO_V1(moddatetime)
Datum moddatetime(PG_FUNCTION_ARGS)
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static Datum CStringGetDatum(const char *X)
static Datum Int32GetDatum(int32 X)
char * SPI_getrelname(Relation rel)
int SPI_fnumber(TupleDesc tupdesc, const char *fname)
Oid SPI_gettypeid(TupleDesc tupdesc, int fnumber)
#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)