Re: BUG #17798: Incorrect memory access occurs when using BEFORE ROW UPDATE trigger

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alexander Lakhin <exclusion(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)lists(dot)postgresql(dot)org, Richard Guo <guofenglinux(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Peter Geoghegan <pg(at)bowt(dot)ie>
Subject: Re: BUG #17798: Incorrect memory access occurs when using BEFORE ROW UPDATE trigger
Date: 2024-01-11 14:34:56
Message-ID: CA+TgmobRr7iWYNNj+-djD6AkoS5trpL8JznXbfO74+dtmCsOsg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Jan 10, 2024 at 10:00 PM Alexander Lakhin <exclusion(at)gmail(dot)com> wrote:
> here trigger.c:3055 points at the second call in ExecBRUpdateTriggers():
> newtuple = ExecFetchSlotHeapTuple(newslot, true, &should_free_new);
>
> Does it makes more sense?

Ah, OK, makes tons of sense.

> I was discouraged by that vast distance and implicit buffer usage too, but
> I found no other feasible way to fix it. On the other hand, 75e03eabe and
> Andres's words upthread made me believe that it's an acceptable solution.

I agree that it's potentially acceptable. I just wonder if Tom or
someone else is going to want to propose a bigger change to avoid some
of this messiness. I don't know what that would look like, though.

If not, then I think your patch should be committed and back-patched
pretty much as you have it, except with better comments.

> Thank you very much for diving deep into this subject!

yw.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-01-11 16:01:39 Re: BUG #18284: Filter in left lateral join not respected
Previous Message PG Bug reporting form 2024-01-11 14:34:55 BUG #18284: Filter in left lateral join not respected