Re: BUG #16139: Assertion fails on INSERT into a postgres_fdw' tablewith two AFTER INSERT triggers
От | Etsuro Fujita |
---|---|
Тема | Re: BUG #16139: Assertion fails on INSERT into a postgres_fdw' tablewith two AFTER INSERT triggers |
Дата | |
Msg-id | CAPmGK15st2aAuWXn8FCeyYg1Jvu7NCtH0=BdvPZoUCmXMq09Kg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #16139: Assertion fails on INSERT into a postgres_fdw' tablewith two AFTER INSERT triggers (Etsuro Fujita <etsuro.fujita@gmail.com>) |
Ответы |
Re: BUG #16139: Assertion fails on INSERT into a postgres_fdw' tablewith two AFTER INSERT triggers
|
Список | pgsql-bugs |
On Wed, Nov 27, 2019 at 8:35 PM Etsuro Fujita <etsuro.fujita@gmail.com> wrote: > A bit of investigation showed that this is caused by commit > ff11e7f4b9ae017585c3ba146db7ba39c31f209a. I haven't yet looked at the > commit in any detail, though. I spent some time studying the commit. I think AfterTriggerExecute() should make sure that: * foreign tables always use zero and save the tuple(s) to a * tuplestore. AFTER_TRIGGER_FDW_FETCH directs AfterTriggerExecute() to * retrieve a fresh tuple or pair of tuples from that tuplestore, while * AFTER_TRIGGER_FDW_REUSE directs it to use the most-recently-retrieved * tuple(s). This permits storing tuples once regardless of the number of * row-level triggers on a foreign table. But the commit modified that function to clear the tg_trigslot and tg_newslot slots' contents, which are reused when AFTER_TRIGGER_FDW_REUSE, as shown below: @@ -4374,12 +4373,17 @@ AfterTriggerExecute(AfterTriggerEvent event, heap_freetuple(rettuple); /* - * Release buffers + * Release resources */ - if (buffer1 != InvalidBuffer) - ReleaseBuffer(buffer1); - if (buffer2 != InvalidBuffer) - ReleaseBuffer(buffer2); + if (should_free_trig) + heap_freetuple(LocTriggerData.tg_trigtuple); + if (should_free_new) + heap_freetuple(LocTriggerData.tg_newtuple); + + if (LocTriggerData.tg_trigslot) + ExecClearTuple(LocTriggerData.tg_trigslot); + if (LocTriggerData.tg_newslot) + ExecClearTuple(LocTriggerData.tg_newslot); Attached is a patch for fixing that. Maybe I'm missing something, though. Best regards, Etsuro Fujita
Вложения
В списке pgsql-bugs по дате отправления: