Alexander Lakhin <exclusion@gmail.com> writes:
> 12.01.2024 17:56, Robert Haas wrote:
>> I don't understand why it's ever safe to skip ExecMaterializeSlot
>> here. IIUC, if we have no EPQ slot, newslot is still not materialized
>> and thus dependent on oldslot ... and we're about to
>> ExecFetchSlotHeapTuple on oldslot.
> To my understanding, when we have no epqslot_candidate, it means that
> newslot came from ExecBRUpdateTriggers's callers and it can't be dependent
> on an internal oldslot's buffer.
After sleeping on it, I'm inclined to the opinion that unconditionally
materializing newslot here is a good idea. Given that we're about to
call one or more trigger functions, the incremental cost ought to be
pretty negligible. The reduction in the state space that we have to
reason about seems fairly significant, too. Remember that a trigger
function could do almost anything. So I like this not only for
providing a straightforward fix for the current problem, but as a
guard against unrecognized or future bugs in this area. 75e03eabe
should be sufficient evidence that there's a lot of hazard here
(and I especially like being able to revert that wart).
regards, tom lane