Index: src/bin/pg_dump/pg_backup.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v
retrieving revision 1.37
diff -c -r1.37 pg_backup.h
*** src/bin/pg_dump/pg_backup.h	15 Oct 2005 02:49:38 -0000	1.37
--- src/bin/pg_dump/pg_backup.h	16 Dec 2005 17:57:29 -0000
***************
*** 115,120 ****
--- 115,122 ----
  
  	int			suppressDumpWarnings;	/* Suppress output of WARNING entries
  										 * to stderr */
+     bool        single_txn;
+ 
  } RestoreOptions;
  
  /*
Index: src/bin/pg_dump/pg_backup_archiver.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.118
diff -c -r1.118 pg_backup_archiver.c
*** src/bin/pg_dump/pg_backup_archiver.c	22 Nov 2005 18:17:28 -0000	1.118
--- src/bin/pg_dump/pg_backup_archiver.c	16 Dec 2005 17:57:31 -0000
***************
*** 217,222 ****
--- 217,225 ----
  
  	AH->stage = STAGE_PROCESSING;
  
+     if (ropt->single_txn)
+ 		ahprintf(AH, "BEGIN;\n\n");
+ 
  	/*
  	 * Drop the items at the start, in reverse order
  	 */
***************
*** 365,370 ****
--- 368,376 ----
  		}
  	}
  
+     if (ropt->single_txn)
+ 		ahprintf(AH, "COMMIT;\n\n");
+ 
  	if (AH->public.verbose)
  		dumpTimestamp(AH, "Completed on", time(NULL));
  
Index: src/bin/pg_dump/pg_restore.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v
retrieving revision 1.73
diff -c -r1.73 pg_restore.c
*** src/bin/pg_dump/pg_restore.c	15 Oct 2005 02:49:39 -0000	1.73
--- src/bin/pg_dump/pg_restore.c	16 Dec 2005 17:57:31 -0000
***************
*** 105,110 ****
--- 105,111 ----
  		{"password", 0, NULL, 'W'},
  		{"schema", 1, NULL, 'n'},
  		{"schema-only", 0, NULL, 's'},
+ 		{"single-txn", 0, NULL, 'N'},
  		{"superuser", 1, NULL, 'S'},
  		{"table", 1, NULL, 't'},
  		{"trigger", 1, NULL, 'T'},
***************
*** 142,148 ****
  		}
  	}
  
! 	while ((c = getopt_long(argc, argv, "acCd:ef:F:h:iI:lL:n:Op:P:RsS:t:T:uU:vWxX:",
  							cmdopts, NULL)) != -1)
  	{
  		switch (c)
--- 143,149 ----
  		}
  	}
  
! 	while ((c = getopt_long(argc, argv, "acCd:ef:F:h:iI:lL:n:NOp:P:RsS:t:T:uU:vWxX:",
  							cmdopts, NULL)) != -1)
  	{
  		switch (c)
***************
*** 185,193 ****
--- 186,205 ----
  				opts->tocFile = strdup(optarg);
  				break;
  
+ 			case 'n':			/* Dump data for this schema only */
+ 				opts->selTypes = 1;
+ 				opts->schemaNames = strdup(optarg);
+ 				break;
+ 
+ 			case 'N':			/* Restore data in a single transaction */
+ 				opts->single_txn = true;
+ 				opts->exit_on_error = true;
+ 				break;
+ 
  			case 'O':
  				opts->noOwner = 1;
  				break;
+ 
  			case 'p':
  				if (strlen(optarg) != 0)
  					opts->pgport = strdup(optarg);
***************
*** 223,233 ****
  				opts->tableNames = strdup(optarg);
  				break;
  
- 			case 'n':			/* Dump data for this schema only */
- 				opts->selTypes = 1;
- 				opts->schemaNames = strdup(optarg);
- 				break;
- 
  			case 'u':
  				opts->requirePassword = true;
  				opts->username = simple_prompt("User name: ", 100, true);
--- 235,240 ----
***************
*** 380,385 ****
--- 387,393 ----
  	printf(_("  -L, --use-list=FILENAME  use specified table of contents for ordering\n"
  			 "                           output from this file\n"));
  	printf(_("  -n, --schema=NAME        restore only objects in this schema\n"));
+ 	printf(_("  -N, --single-txn         restore as a single transaction\n"));
  	printf(_("  -O, --no-owner           skip restoration of object ownership\n"));
  	printf(_("  -P, --function=NAME(args)\n"
  			 "                           restore named function\n"));
