2020 *
2121 *
2222 * IDENTIFICATION
23- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.20 1996/12/28 22:44:58 momjian Exp $
23+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.21 1996/12/30 23:05:16 bryanh Exp $
2424 *
2525 * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2626 *
@@ -161,8 +161,8 @@ dumpClasses_nodumpData(FILE *fout, const char *classname, const bool oids) {
161161 }else {
162162copydone = false;
163163while (!copydone ) {
164- ret = PQgetline (res -> conn ,copybuf ,COPYBUFSIZ );
165-
164+ ret = PQgetline (res -> conn ,copybuf ,COPYBUFSIZ );
165+
166166if (copybuf [0 ]== '\\' &&
167167copybuf [1 ]== '.' &&
168168copybuf [2 ]== '\0' ) {
@@ -184,7 +184,16 @@ dumpClasses_nodumpData(FILE *fout, const char *classname, const bool oids) {
184184fprintf (fout ,"\\.\n" );
185185 }
186186PQclear (res );
187- PQendcopy (res -> conn );
187+ ret = PQendcopy (res -> conn );
188+ if (ret != 0 ) {
189+ fprintf (stderr ,"SQL query to dump the contents of Table %s "
190+ "did not execute correctly. After we read all the "
191+ "table contents from the backend, PQendcopy() failed. "
192+ "Explanation from backend: '%s'.\n"
193+ "The query was: '%s'.\n" ,
194+ classname ,PQerrorMessage (g_conn ),query );
195+ exit_nicely (g_conn );
196+ }
188197 }
189198}
190199
@@ -287,8 +296,7 @@ dumpClasses(const TableInfo tblinfo[], const int numTables, FILE *fout,
287296int i ;
288297char * all_only ;
289298
290- if (onlytable == NULL )
291- all_only = "all" ;
299+ if (onlytable == NULL )all_only = "all" ;
292300else all_only = "one" ;
293301
294302if (g_verbose )
@@ -297,7 +305,7 @@ dumpClasses(const TableInfo tblinfo[], const int numTables, FILE *fout,
297305
298306for (i = 0 ;i < numTables ;i ++ ) {
299307const char * classname = tblinfo [i ].relname ;
300-
308+
301309if (!onlytable || (!strcmp (classname ,onlytable ))) {
302310if (g_verbose )
303311fprintf (stderr ,"%s dumping out the contents of Table %s %s\n" ,