Hi,
ExportSnapshot() has, right at the beginning, the following block:
/* * We cannot export a snapshot from a subtransaction because there's no * easy way for importers to verify
thatthe same subtransaction is still * running. */ if (IsSubTransaction()) ereport(ERROR,
(errcode(ERRCODE_ACTIVE_SQL_TRANSACTION), errmsg("cannot export a snapshot from a subtransaction")));
that reasoning doesn't seem to make too much sense to me. Given that
exported snapshots don't make the exporting-transaction's changes
visible, I don't see why that restriction is needed?
As long as the exported snapshot enforces xmin to be retained, which it
does via the pairingheap, I don't understand why we'd have to enforce
that the subtransaction is still running?
I don't have any need for that capability right now, thus am not
planning to submit a patch changing this, but I'm about to apply a patch
to ExportSnapshot() to address one of the v10 open items, so I'd like to
make sure I understand the constraints.
Greetings,
Andres Freund