* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.255 2009/10/26 02:26:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.256 2009/10/27 20:14:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
int ntriggers;
int *tgindx;
+ /*
+ * Check state. We use normal tests not Asserts because it is possible
+ * to reach here in the wrong state given misconfigured RI triggers,
+ * in particular deferring a cascade action trigger.
+ */
if (afterTriggers == NULL)
elog(ERROR, "AfterTriggerSaveEvent() called outside of transaction");
- Assert(afterTriggers->query_depth >= 0);
+ if (afterTriggers->query_depth < 0)
+ elog(ERROR, "AfterTriggerSaveEvent() called outside of query");
/*
* Validate the event code and collect the associated tuple CTIDs.