* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.248.2.2 2010/01/24 21:49:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.248.2.3 2010/08/19 15:46:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
else
events->tail->next = chunk;
events->tail = chunk;
+ /* events->tailfree is now out of sync, but we'll fix it below */
}
/*
{
chunk->freeptr = CHUNK_DATA_START(chunk);
chunk->endfree = chunk->endptr;
+
+ /*
+ * If it's last chunk, must sync event list's tailfree too. Note
+ * that delete_ok must NOT be passed as true if there could be
+ * stacked AfterTriggerEventList values pointing at this event
+ * list, since we'd fail to fix their copies of tailfree.
+ */
+ if (chunk == events->tail)
+ events->tailfree = chunk->freeptr;
}
}