Re: BUG #15990: PROCEDURE throws "SQL Error [XX000]: ERROR: no known snapshots" with PostGIS geometries

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, a(dot)wicht(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: BUG #15990: PROCEDURE throws "SQL Error [XX000]: ERROR: no known snapshots" with PostGIS geometries
Date: 2021-05-12 15:51:53
Message-ID: 20210512155153.qb6dpsg56doicg57@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2021-05-12 11:37:46 -0400, Tom Lane wrote:
> ISTM there are two ways we could look at this:
>
> 1. COMMIT is dropping the ball by not forcing there to be any
> registered transaction-level snapshot afterward. (Maybe it's
> not exactly COMMIT that must do this, but in any case the
> snapshot situation after COMMIT is clearly different from
> normal running, and that seems highly bug-prone.)
>
> 2. GetOldestSnapshot ought to be willing to fall back to
> CurrentSnapshot if FirstSnapshotSet is true but there are
> no active or registered snapshots. But it's not clear how
> its promises about returning the "oldest" snapshot would apply.

FirstSnapshotSet doesn't indicate the snapshot is usable, unless
IsolationUsesXactSnapshot() - in which case it also registers the
snapshot. We don't maintain MyProc->xmin outside of that, which I think
means we can't rely on the snapshot at all? Or am I missing something?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-05-12 16:00:10 Re: BUG #15990: PROCEDURE throws "SQL Error [XX000]: ERROR: no known snapshots" with PostGIS geometries
Previous Message Tom Lane 2021-05-12 15:37:46 Re: BUG #15990: PROCEDURE throws "SQL Error [XX000]: ERROR: no known snapshots" with PostGIS geometries