Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7ab0ceb

Browse files
author
Bryan Henderson
committed
Check that PQendcopy succeeded. Issue error message if not.
1 parent765dd2a commit7ab0ceb

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
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 {
162162
copydone= false;
163163
while (!copydone) {
164-
ret=PQgetline(res->conn,copybuf,COPYBUFSIZ);
165-
164+
ret=PQgetline(res->conn,copybuf,COPYBUFSIZ);
165+
166166
if (copybuf[0]=='\\'&&
167167
copybuf[1]=='.'&&
168168
copybuf[2]=='\0') {
@@ -184,7 +184,16 @@ dumpClasses_nodumpData(FILE *fout, const char *classname, const bool oids) {
184184
fprintf(fout,"\\.\n");
185185
}
186186
PQclear(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,
287296
inti;
288297
char*all_only;
289298

290-
if (onlytable==NULL)
291-
all_only="all";
299+
if (onlytable==NULL)all_only="all";
292300
elseall_only="one";
293301

294302
if (g_verbose)
@@ -297,7 +305,7 @@ dumpClasses(const TableInfo tblinfo[], const int numTables, FILE *fout,
297305

298306
for(i=0;i<numTables;i++) {
299307
constchar*classname=tblinfo[i].relname;
300-
308+
301309
if (!onlytable|| (!strcmp(classname,onlytable))) {
302310
if (g_verbose)
303311
fprintf(stderr,"%s dumping out the contents of Table %s %s\n",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp