Re: Assertion failure in HEAD and 13 after calling COMMIT in a stored proc - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Assertion failure in HEAD and 13 after calling COMMIT in a stored proc
Date
Msg-id 2078959.1624453315@sss.pgh.pa.us
Whole thread Raw
In response to Re: Assertion failure in HEAD and 13 after calling COMMIT in a stored proc  (Greg Nancarrow <gregn4422@gmail.com>)
Responses Re: Assertion failure in HEAD and 13 after calling COMMIT in a stored proc  (Greg Nancarrow <gregn4422@gmail.com>)
List pgsql-hackers
Greg Nancarrow <gregn4422@gmail.com> writes:
> On Tue, Jun 22, 2021 at 10:56 PM Ranier Vilela <ranier.vf@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



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: PG 14 release notes, first draft
Next
From: Alvaro Herrera
Date:
Subject: Re: pgbench logging broken by time logic changes