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

Commitc822fe0

Browse files
committed
pg_dumpall should enforce the server version check for itself, rather
than simply passing it down to pg_dump. Else, version-related failuresin pg_dumpall itself generate unhelpful error messages.
1 parent8023b7f commitc822fe0

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

‎src/bin/pg_dump/pg_dumpall.c

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.58 2005/02/22 04:39:38 momjian Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.59 2005/04/18 23:47:52 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -63,6 +63,7 @@ PQExpBuffer pgdumpopts;
6363
booloutput_clean= false;
6464
boolskip_acls= false;
6565
boolverbose= false;
66+
staticboolignoreVersion= false;
6667
intserver_version;
6768

6869
/* flags for -X long options */
@@ -193,11 +194,13 @@ main(int argc, char *argv[])
193194

194195
break;
195196

196-
197-
198197
case'i':
198+
ignoreVersion= true;
199+
appendPQExpBuffer(pgdumpopts," -i");
200+
break;
201+
199202
case'o':
200-
appendPQExpBuffer(pgdumpopts," -%c",c);
203+
appendPQExpBuffer(pgdumpopts," -o");
201204
break;
202205

203206
case'O':
@@ -935,6 +938,7 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport,
935938
char*password=NULL;
936939
boolneed_pass= false;
937940
constchar*remoteversion_str;
941+
intmy_version;
938942

939943
if (require_password)
940944
password=simple_prompt("Password: ",100, false);
@@ -992,6 +996,29 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport,
992996
exit(1);
993997
}
994998

999+
my_version=parse_version(PG_VERSION);
1000+
if (my_version<0)
1001+
{
1002+
fprintf(stderr,_("%s: could not parse version \"%s\"\n"),
1003+
progname,PG_VERSION);
1004+
exit(1);
1005+
}
1006+
1007+
if (my_version!=server_version
1008+
&& (server_version<70000/* we can handle back to 7.0 */
1009+
||server_version>my_version))
1010+
{
1011+
fprintf(stderr,_("server version: %s; %s version: %s\n"),
1012+
remoteversion_str,progname,PG_VERSION);
1013+
if (ignoreVersion)
1014+
fprintf(stderr,_("proceeding despite version mismatch\n"));
1015+
else
1016+
{
1017+
fprintf(stderr,_("aborting because of version mismatch (Use the -i option to proceed anyway.)\n"));
1018+
exit(1);
1019+
}
1020+
}
1021+
9951022
returnconn;
9961023
}
9971024

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp