Re: Segmentation fault during update inside ExecBRUpdateTriggers

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Segmentation fault during update inside ExecBRUpdateTriggers
Дата
Msg-id 32545.1565908764@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Segmentation fault during update inside ExecBRUpdateTriggers  (Thomas Munro <thomas.munro@gmail.com>)
Ответы Re: Segmentation fault during update inside ExecBRUpdateTriggers  (Andres Freund <andres@anarazel.de>)
Re: Segmentation fault during update inside ExecBRUpdateTriggers  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Thomas Munro <thomas.munro@gmail.com> writes:
> Right, this happens on REL_11_STABLE but not on master (which rewrote
> the relevant code quite a bit in the "slotification" project).

We should probably trace back why it doesn't happen before v11.
I have a vague memory of having touched this code a year or two
back, so likely this is my fault, but I wonder why it doesn't
fail before.

> In a very quick test, the following change fixes the problem and
> passes regression tests, but I'm not sure if it's the right fix.

> -               if (oldtuple != newtuple && oldtuple != slottuple)
> +               if (oldtuple != newtuple && oldtuple != slottuple &&
> oldtuple != trigtuple)

My thoughts were headed in the same direction.  It looks like the
issue is that the first trigger returns OLD, ie "trigtuple",
which gets assigned to "newtuple", and then the second iteration
of the loop fails to deal with the aliasing.

[ thinks some more... ]  Actually, I'm beginning to recall that
we made changes here because v11 plpgsql is capable of actually
returning "trigtuple" where before it would always have made a copy.
If that's accurate, then very likely the bug exists further back
but requires some other PL than plpgsql to manifest.

I'd be inclined to put a test case exercising this into all branches,
even ones not currently showing the bug, because it's clearly a
fragile area.

            regards, tom lane



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

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: Segmentation fault during update inside ExecBRUpdateTriggers
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Segmentation fault during update inside ExecBRUpdateTriggers