|
6 | 6 | * Portions Copyright (c) 1994, Regents of the University of California |
7 | 7 | * |
8 | 8 | * |
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 $ |
10 | 10 | * |
11 | 11 | *------------------------------------------------------------------------- |
12 | 12 | */ |
@@ -63,6 +63,7 @@ PQExpBuffer pgdumpopts; |
63 | 63 | booloutput_clean= false; |
64 | 64 | boolskip_acls= false; |
65 | 65 | boolverbose= false; |
| 66 | +staticboolignoreVersion= false; |
66 | 67 | intserver_version; |
67 | 68 |
|
68 | 69 | /* flags for -X long options */ |
@@ -193,11 +194,13 @@ main(int argc, char *argv[]) |
193 | 194 |
|
194 | 195 | break; |
195 | 196 |
|
196 | | - |
197 | | - |
198 | 197 | case'i': |
| 198 | +ignoreVersion= true; |
| 199 | +appendPQExpBuffer(pgdumpopts," -i"); |
| 200 | +break; |
| 201 | + |
199 | 202 | case'o': |
200 | | -appendPQExpBuffer(pgdumpopts," -%c",c); |
| 203 | +appendPQExpBuffer(pgdumpopts," -o"); |
201 | 204 | break; |
202 | 205 |
|
203 | 206 | case'O': |
@@ -935,6 +938,7 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport, |
935 | 938 | char*password=NULL; |
936 | 939 | boolneed_pass= false; |
937 | 940 | constchar*remoteversion_str; |
| 941 | +intmy_version; |
938 | 942 |
|
939 | 943 | if (require_password) |
940 | 944 | password=simple_prompt("Password: ",100, false); |
@@ -992,6 +996,29 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport, |
992 | 996 | exit(1); |
993 | 997 | } |
994 | 998 |
|
| 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 | + |
995 | 1022 | returnconn; |
996 | 1023 | } |
997 | 1024 |
|
|