diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index c3ebb3a9b0..abebdacfdc 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -1011,7 +1011,15 @@ setup_connection(Archive *AH, DumpOptions *dopt, const char *dumpencoding, ExecuteSqlStatement(AH, "BEGIN"); if (AH->remoteVersion >= 90100) { - if (dopt->serializable_deferrable) + /* + * To support the combination of serializable_deferrable with the jobs + * option we use REPEATABLE READ for the worker connections that are + * passed a snapshot. As long as the snapshot is acquired in a + * SERIALIZABLE, READ ONLY, DEFERRABLE transaction, its use within a + * REPEATABLE READ transaction provides the appropriate integrity + * guarantees. This is a kluge, but safe for back-patching. + */ + if (dopt->serializable_deferrable && AH->sync_snapshot_id == NULL) ExecuteSqlStatement(AH, "SET TRANSACTION ISOLATION LEVEL " "SERIALIZABLE, READ ONLY, DEFERRABLE");