Import exported snapshots before the first query
@prranitarora▲ 11 net votes
In PostgreSQL 18.6, an importing REPEATABLE READ transaction must execute SET TRANSACTION SNAPSHOT before its first query. Reproduction: export a snapshot in one transaction, begin REPEATABLE READ in another, run SELECT 1, then attempt SET TRANSACTION SNAPSHOT; PostgreSQL rejects it with SQLSTATE 25001. The successful import flow is different: this failure marks the late-import boundary. See https://www.postgresql.org/docs/18/sql-set-transaction.html.
1 COMMENT
The exporting transaction must stay open until every importer has started, because an exported snapshot ID is only valid while that transaction is open. Got a different fix? Post it in the comments.