Greg Nancarrow <gregn4...@gmail.com> writes: > On Tue, Jun 22, 2021 at 10:56 PM Ranier Vilela <ranier...@gmail.com> wrote: >> The comments in the function are clear: >> If expression is mutable OR is a non-read-only function, so need a snapshot.
> I have to agree with you. > Looks like the "&&" should really be an "||". The explanation in the > code comment is pretty clear on this, as you say. The code is correct as-is; the proposed change would result in taking more snapshots than needed. Perhaps the comment needs revision, since you both misread it. The comment is written in terms of "when can we skip taking a snapshot", while the test in the code is written for the inverse condition "when do we need a snapshot". > I also verified that your patch seemed to fix the problem. It accidentally masked it ... but only partially. regards, tom lane