diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 7a8588cdf6e02278b2a2d842b14d6f68f72c13d0..09c96a71ce9bab327be9e0f050c165f7d7e14ebb 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *		$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.154 2008/04/13 03:49:21 tgl Exp $
+ *		$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.155 2008/05/03 23:32:32 adunstan Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -219,6 +219,11 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
 			ahprintf(AH, "BEGIN;\n\n");
 	}
 
+	/*
+	 * Disable statement_timeout in archive for pg_restore/psql
+	 */
+	ahprintf(AH, "SET statement_timeout = 0;\n");
+
 	/*
 	 * Establish important parameter values right away.
 	 */
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index dbc3a191b5e8926dcd9414e6372e5ab48d248288..f7ac1706de83193ec8f994f6ea6f141cae6fd2e9 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
  *	by PostgreSQL
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.488 2008/04/14 17:05:33 tgl Exp $
+ *	  $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.489 2008/05/03 23:32:32 adunstan Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -570,6 +570,12 @@ main(int argc, char **argv)
 	if (g_fout->remoteVersion >= 80300)
 		do_sql_command(g_conn, "SET synchronize_seqscans TO off");
 
+	/*
+	 * Disable timeouts if supported.
+	 */
+	if (g_fout->remoteVersion >= 70300)
+		do_sql_command(g_conn, "SET statement_timeout = 0");
+         
 	/*
 	 * Start serializable transaction to dump consistent data.
 	 */