Re: BUG #17462: Invalid memory access in heapam_tuple_lock

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: anisimow(dot)d(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17462: Invalid memory access in heapam_tuple_lock
Date: 2022-04-12 21:40:05
Message-ID: 995052.1649799605@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> As written here, even though there's no obvious API break, there is
> a subtle change: heap_fetch will now return tuple->t_data = NULL after
> a snapshot failure. I'm of two minds whether to back-patch that part
> (not doing so would require more changes in heapam_tuple_lock, though).

After further thought I think we shouldn't back-patch that part: it
could easily break code that's functionally correct today, and there
isn't any case that it makes better without caller-code changes.

(I'm not sure what made me think it'd affect heapam_tuple_lock; that
function only cares about the behavior with keep_buf = true.)

Hence, I end up with two different patches for HEAD and the back branches.
In HEAD, we explicitly break heap_fetch compatibility by adding a new
argument, and we can make the commit message note the more subtle change
too. In the back branches, the behavior of heap_fetch is unchanged
and heapam_tuple_lock has to use heap_fetch_extended.

regards, tom lane

Attachment Content-Type Size
heap_fetch-fix-HEAD.patch text/x-diff 5.5 KB
heap_fetch-fix-v14.patch text/x-diff 5.2 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Susanne Holzgraefe 2022-04-13 08:38:28 replace() using NULL
Previous Message Tom Lane 2022-04-12 14:41:46 Re: BUG #17464: Domain type. If the value field(CREATE DOMAIN) is set to null, errors cannot be intercepted.