if (!CALLED_AS_TRIGGER(fcinfo))
/* internal error */
elog(ERROR, "not fired by trigger manager");
- if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
+ if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
/* internal error */
- elog(ERROR, "cannot process STATEMENT events");
- if (TRIGGER_FIRED_AFTER(trigdata->tg_event))
+ elog(ERROR, "must be fired for row");
+ if (!TRIGGER_FIRED_BEFORE(trigdata->tg_event))
/* internal error */
elog(ERROR, "must be fired before event");
if (!CALLED_AS_TRIGGER(fcinfo))
/* internal error */
elog(ERROR, "insert_username: not fired by trigger manager");
- if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
+ if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
/* internal error */
- elog(ERROR, "insert_username: cannot process STATEMENT events");
- if (TRIGGER_FIRED_AFTER(trigdata->tg_event))
+ elog(ERROR, "insert_username: must be fired for row");
+ if (!TRIGGER_FIRED_BEFORE(trigdata->tg_event))
/* internal error */
elog(ERROR, "insert_username: must be fired before event");
/* internal error */
elog(ERROR, "moddatetime: not fired by trigger manager");
- if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
+ if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
/* internal error */
- elog(ERROR, "moddatetime: cannot process STATEMENT events");
+ elog(ERROR, "moddatetime: must be fired for row");
- if (TRIGGER_FIRED_AFTER(trigdata->tg_event))
+ if (!TRIGGER_FIRED_BEFORE(trigdata->tg_event))
/* internal error */
elog(ERROR, "moddatetime: must be fired before event");
if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event))
/* internal error */
- elog(ERROR, "moddatetime: must be fired before event");
+ elog(ERROR, "moddatetime: cannot process INSERT events");
else if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
rettuple = trigdata->tg_newtuple;
else
elog(ERROR, "check_primary_key: not fired by trigger manager");
/* Should be called for ROW trigger */
- if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
+ if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
/* internal error */
- elog(ERROR, "check_primary_key: cannot process STATEMENT events");
+ elog(ERROR, "check_primary_key: must be fired for row");
/* If INSERTion then must check Tuple to being inserted */
if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event))
elog(ERROR, "check_foreign_key: not fired by trigger manager");
/* Should be called for ROW trigger */
- if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
+ if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
/* internal error */
- elog(ERROR, "check_foreign_key: cannot process STATEMENT events");
+ elog(ERROR, "check_foreign_key: must be fired for row");
/* Not should be called for INSERT */
if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event))
elog(ERROR, "timetravel: not fired by trigger manager");
/* Should be called for ROW trigger */
- if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
- elog(ERROR, "timetravel: cannot process STATEMENT events");
+ if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
+ elog(ERROR, "timetravel: must be fired for row");
/* Should be called BEFORE */
- if (TRIGGER_FIRED_AFTER(trigdata->tg_event))
+ if (!TRIGGER_FIRED_BEFORE(trigdata->tg_event))
elog(ERROR, "timetravel: must be fired before event");
/* INSERT ? */
elog(ERROR, "tsvector_update_trigger: not fired by trigger manager");
trigdata = (TriggerData *) fcinfo->context;
- if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
- elog(ERROR, "tsvector_update_trigger: can't process STATEMENT events");
- if (TRIGGER_FIRED_AFTER(trigdata->tg_event))
+ if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
+ elog(ERROR, "tsvector_update_trigger: must be fired for row");
+ if (!TRIGGER_FIRED_BEFORE(trigdata->tg_event))
elog(ERROR, "tsvector_update_trigger: must be fired BEFORE event");
if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event))
rec_old->tupdesc = trigdata->tg_relation->rd_att;
rec_old->freetupdesc = false;
- if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
+ if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
{
/*
* Per-statement triggers don't use OLD/NEW variables
* attributes don't have the correct atttypmod's length. It's up to the
* trigger's programmer to ensure that this doesn't happen. Jan
*/
- if (estate.retisnull || TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
+ if (estate.retisnull || !TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
rettup = NULL;
else
{
Py_DECREF(plttableschema);
pfree(stroid);
-
if (TRIGGER_FIRED_BEFORE(tdata->tg_event))
pltwhen = PyString_FromString("BEFORE");
else if (TRIGGER_FIRED_AFTER(tdata->tg_event))
if (!CALLED_AS_TRIGGER(fcinfo))
elog(ERROR, "ttdummy: not fired by trigger manager");
- if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
- elog(ERROR, "ttdummy: cannot process STATEMENT events");
- if (TRIGGER_FIRED_AFTER(trigdata->tg_event))
+ if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
+ elog(ERROR, "ttdummy: must be fired for row");
+ if (!TRIGGER_FIRED_BEFORE(trigdata->tg_event))
elog(ERROR, "ttdummy: must be fired before event");
if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event))
elog(ERROR, "ttdummy: cannot process INSERT event");