It occurs to me that we could get rid of the
ReferentialIntegritySnapshotOverride flag (which I consider both ugly
and dangerous) if we tweaked ExecutorStart to accept the snapshot-to-use
as a parameter. Then RI queries could pass in SnapshotNow instead of
the normal query snapshot, and we'd not need a low-level hack anymore.
Since the RI triggers actually go through SPI, this'd mean offering
an alternate version of SPI_execp that allows specifying the snapshot,
but that seems no big problem.
Comments?
(I'm also wondering if we couldn't get rid of AMI_OVERRIDE, possibly
with a little bit of cleanup of bootstrapping...)
regards, tom lane