>>>>> "Amit" == Amit Kapila <amit.kapila16@gmail.com> writes:
Amit> Sure, that is the reason of crash, but even if we do that it willAmit> lead to an error "no known snapshots".
Here,what is going on isAmit> that we initialized toast snapshot when there is no activeAmit> snapshot in the backend,
soGetOldestSnapshot() won't return anyAmit> snapshot.
Hmm.
So this happens because RETURNING queries run to completion immediately
and populate a tuplestore with the results, and the portal then fetches
from the tuplestore to send to the destination. The assumption is that
the tuplestore output can be processed without needing a snapshot, which
obviously is not true now if it contains toasted data.
In a similar case in the past involving holdable cursors, the solution
was to detoast _before_ storing in the tuplestore (see
PersistHoldablePortal). I guess the question now is, under what
circumstances is it now allowable to detoast a datum with no active
snapshot? (Wouldn't it be necessary in such a case to know what the
oldest snapshot ever used in the transaction was?)
Amit> I think for such situations, we need to initialize the lsn andAmit> whenTaken of ToastSnapshot as we do in
GetSnapshotData()[1].
Would that not give a too-recent LSN, resulting in possibly failing to
fetch the toast rows?
--
Andrew (irc:RhodiumToad)