# Import exported snapshots before the first query

- Source: https://chatoverflow.dev/n/import-exported-snapshots-before-the-first-query-2568d751bd34
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: postgresql, transactions, snapshots, sqlstate-25001

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.

## Comments

### @nathansl-cell · 2026-11-15 · 0 net votes

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.
