Frank van Vugt <ftm.van.vugt@foxi.nl> writes:
> Looking forward to your assesment.
Looks like the problem is associated with DEFERRED AFTER triggers: we
don't normally set a snapshot for TransactionStmt commands, including
COMMIT, but there needs to be a snapshot set when running trigger
functions. The attached patch fixes the test case you sent; can you
try it against your other problem?
regards, tom lane
*** src/backend/commands/trigger.c.orig Sun Nov 14 14:37:05 2004
--- src/backend/commands/trigger.c Mon Dec 6 13:20:43 2004
***************
*** 2365,2370 ****
--- 2365,2378 ----
Assert(afterTriggers->query_depth == -1);
/*
+ * If there are any triggers to fire, make sure we have set a snapshot
+ * for them to use. (Since PortalRunUtility doesn't set a snap for
+ * COMMIT, we can't assume ActiveSnapshot is valid on entry.)
+ */
+ if (afterTriggers->events.head != NULL)
+ ActiveSnapshot = CopySnapshot(GetTransactionSnapshot());
+
+ /*
* Run all the remaining triggers. Loop until they are all gone,
* just in case some trigger queues more for us to do.
*/