Re: "invalid memory alloc request size " in deferred trigger causes transaction to fail, but the backend keeps running

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: "invalid memory alloc request size " in deferred trigger causes transaction to fail, but the backend keeps running
Дата
Msg-id 4896.1102357355@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: "invalid memory alloc request size " in deferred trigger causes transaction to fail, but the backend keeps running  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
Ответы Re: "invalid memory alloc request size " in deferred trigger causes transaction to fail, but the backend keeps running  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
Список pgsql-bugs
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.
       */

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Ed L."
Дата:
Сообщение: Re: serial drop error
Следующее
От: Tom Lane
Дата:
Сообщение: Re: serial drop error