diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 84344b45aef..122df375493 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -1004,7 +1004,15 @@ setup_connection(Archive *AH, const char *dumpencoding, char *use_role) ExecuteSqlStatement(AH, "BEGIN"); if (AH->remoteVersion >= 90100) { - if (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 (serializable_deferrable && AH->sync_snapshot_id == NULL) ExecuteSqlStatement(AH, "SET TRANSACTION ISOLATION LEVEL " "SERIALIZABLE, READ ONLY, DEFERRABLE");