Index: doc/src/sgml/ref/pg_restore.sgml
===================================================================
RCS file: /cvsroot/pgsql-server/doc/src/sgml/ref/pg_restore.sgml,v
retrieving revision 1.47
diff -c -c -r1.47 pg_restore.sgml
*** doc/src/sgml/ref/pg_restore.sgml	13 Jul 2004 02:59:49 -0000	1.47
--- doc/src/sgml/ref/pg_restore.sgml	20 Aug 2004 04:09:31 -0000
***************
*** 130,135 ****
--- 130,147 ----
       </varlistentry>
  
       <varlistentry>
+       <term><option>-e</option></term>
+       <term><option>--exit-on-error</option></term>
+       <listitem>
+        <para>
+         Exit if an error is encountered while sending SQL commands to
+         the database. The default is to continue and to display a count of 
+         errors at the end of the restoration.
+        </para>
+       </listitem>
+      </varlistentry>
+ 
+      <varlistentry>
        <term><option>-f <replaceable>filename</replaceable></option></term>
        <term><option>--file=<replaceable>filename</replaceable></option></term>
        <listitem>
Index: src/bin/pg_dump/pg_backup.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/pg_backup.h,v
retrieving revision 1.31
diff -c -c -r1.31 pg_backup.h
*** src/bin/pg_dump/pg_backup.h	13 Jul 2004 03:00:17 -0000	1.31
--- src/bin/pg_dump/pg_backup.h	20 Aug 2004 04:09:37 -0000
***************
*** 59,65 ****
  	int			maxRemoteVersion;
  
  	/* error handling */
! 	bool		die_on_errors;	/* whether to die on sql errors... */
  	int			n_errors;		/* number of errors (if no die) */
  
  	/* The rest is private */
--- 59,65 ----
  	int			maxRemoteVersion;
  
  	/* error handling */
! 	bool		exit_on_error;	/* whether to exit on SQL errors... */
  	int			n_errors;		/* number of errors (if no die) */
  
  	/* The rest is private */
***************
*** 103,108 ****
--- 103,109 ----
  	char	   *username;
  	int			ignoreVersion;
  	int			requirePassword;
+ 	int			exit_on_error;
  
  	bool	   *idWanted;
  	bool		limitToList;
Index: src/bin/pg_dump/pg_backup_archiver.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.92
diff -c -c -r1.92 pg_backup_archiver.c
*** src/bin/pg_dump/pg_backup_archiver.c	13 Aug 2004 21:37:28 -0000	1.92
--- src/bin/pg_dump/pg_backup_archiver.c	20 Aug 2004 04:09:41 -0000
***************
*** 457,462 ****
--- 457,463 ----
  
  	opts->format = archUnknown;
  	opts->suppressDumpWarnings = false;
+ 	opts->exit_on_error = false;
  
  	return opts;
  }
***************
*** 1227,1233 ****
  {
  	va_list ap;
  	va_start(ap, fmt);
! 	if (AH->public.die_on_errors)
  	{
  		_die_horribly(AH, modulename, fmt, ap);
  	}
--- 1228,1234 ----
  {
  	va_list ap;
  	va_start(ap, fmt);
! 	if (AH->public.exit_on_error)
  	{
  		_die_horribly(AH, modulename, fmt, ap);
  	}
***************
*** 1693,1699 ****
  	}
  
  	/* sql error handling */
! 	AH->public.die_on_errors = true;
  	AH->public.n_errors = 0;
  
  	return AH;
--- 1694,1700 ----
  	}
  
  	/* sql error handling */
! 	AH->public.exit_on_error = true;
  	AH->public.n_errors = 0;
  
  	return AH;
Index: src/bin/pg_dump/pg_restore.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/pg_restore.c,v
retrieving revision 1.59
diff -c -c -r1.59 pg_restore.c
*** src/bin/pg_dump/pg_restore.c	13 Jul 2004 03:00:17 -0000	1.59
--- src/bin/pg_dump/pg_restore.c	20 Aug 2004 04:09:42 -0000
***************
*** 90,95 ****
--- 90,96 ----
  		{"create", 0, NULL, 'C'},
  		{"data-only", 0, NULL, 'a'},
  		{"dbname", 1, NULL, 'd'},
+ 		{"exit-on-error", 0, NULL, 'e'},
  		{"file", 1, NULL, 'f'},
  		{"format", 1, NULL, 'F'},
  		{"function", 1, NULL, 'P'},
***************
*** 141,147 ****
  		}
  	}
  
! 	while ((c = getopt_long(argc, argv, "acCd:f:F:h:iI:lL:Op:P:RsS:t:T:uU:vWxX:",
  							cmdopts, NULL)) != -1)
  	{
  		switch (c)
--- 142,148 ----
  		}
  	}
  
! 	while ((c = getopt_long(argc, argv, "acCd:ef:F:h:iI:lL:Op:P:RsS:t:T:uU:vWxX:",
  							cmdopts, NULL)) != -1)
  	{
  		switch (c)
***************
*** 159,164 ****
--- 160,168 ----
  			case 'd':
  				opts->dbname = strdup(optarg);
  				break;
+ 			case 'e':
+ 				opts->exit_on_error = true;
+ 				break;
  			case 'f':			/* output file name */
  				opts->filename = strdup(optarg);
  				break;
***************
*** 321,330 ****
  	/* Let the archiver know how noisy to be */
  	AH->verbose = opts->verbose;
  
! 	/* restore keeps submitting sql commands as "pg_restore ... | psql ... "
! 	 * this behavior choice could be turned into an option.
  	 */
! 	AH->die_on_errors = false;
  
  	if (opts->tocFile)
  		SortTocFromFile(AH, opts);
--- 325,334 ----
  	/* Let the archiver know how noisy to be */
  	AH->verbose = opts->verbose;
  
! 	/*
! 	 *	Whether to keep submitting sql commands as "pg_restore ... | psql ... "
  	 */
! 	AH->exit_on_error = opts->exit_on_error;
  
  	if (opts->tocFile)
  		SortTocFromFile(AH, opts);
***************
*** 391,396 ****
--- 395,401 ----
  	printf(_("  -p, --port=PORT          database server port number\n"));
  	printf(_("  -U, --username=NAME      connect as specified database user\n"));
  	printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
+ 	printf(_("  -e, --exit-on-error      exit on error, default is to continue\n"));
  
  	printf(_("\nIf no input file name is supplied, then standard input is used.\n\n"));
  	printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
