|
12 | 12 | * by PostgreSQL |
13 | 13 | * |
14 | 14 | * IDENTIFICATION |
15 | | - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.486 2008/03/28 00:21:56 tgl Exp $ |
| 15 | + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.487 2008/04/13 03:49:22 tgl Exp $ |
16 | 16 | * |
17 | 17 | *------------------------------------------------------------------------- |
18 | 18 | */ |
@@ -211,19 +211,20 @@ main(int argc, char **argv) |
211 | 211 | int i; |
212 | 212 | bool force_password = false; |
213 | 213 | int compressLevel = -1; |
214 | | - bool ignore_version = false; |
215 | 214 | int plainText = 0; |
216 | 215 | int outputClean = 0; |
217 | 216 | int outputCreate = 0; |
218 | 217 | bool outputBlobs = false; |
219 | 218 | int outputNoOwner = 0; |
220 | 219 | char *outputSuperuser = NULL; |
| 220 | + int my_version; |
| 221 | + int optindex; |
| 222 | + RestoreOptions *ropt; |
| 223 | + |
221 | 224 | static int disable_triggers = 0; |
222 | 225 | static int outputNoTablespaces = 0; |
223 | 226 | static int use_setsessauth = 0; |
224 | 227 |
|
225 | | - RestoreOptions *ropt; |
226 | | - |
227 | 228 | static struct option long_options[] = { |
228 | 229 | {"data-only", no_argument, NULL, 'a'}, |
229 | 230 | {"blobs", no_argument, NULL, 'b'}, |
@@ -266,7 +267,6 @@ main(int argc, char **argv) |
266 | 267 |
|
267 | 268 | {NULL, 0, NULL, 0} |
268 | 269 | }; |
269 | | - int optindex; |
270 | 270 |
|
271 | 271 | set_pglocale_pgservice(argv[0], "pg_dump"); |
272 | 272 |
|
@@ -345,8 +345,8 @@ main(int argc, char **argv) |
345 | 345 | pghost = optarg; |
346 | 346 | break; |
347 | 347 |
|
348 | | - case 'i': /* ignore database version mismatch */ |
349 | | - ignore_version = true; |
| 348 | + case 'i': |
| 349 | + /* ignored, deprecated option */ |
350 | 350 | break; |
351 | 351 |
|
352 | 352 | case 'n': /* include schema(s) */ |
@@ -512,20 +512,26 @@ main(int argc, char **argv) |
512 | 512 | /* Let the archiver know how noisy to be */ |
513 | 513 | g_fout->verbose = g_verbose; |
514 | 514 |
|
515 | | - g_fout->minRemoteVersion = 70000; /* we can handle back to 7.0 */ |
516 | | - g_fout->maxRemoteVersion = parse_version(PG_VERSION); |
517 | | - if (g_fout->maxRemoteVersion < 0) |
| 515 | + my_version = parse_version(PG_VERSION); |
| 516 | + if (my_version < 0) |
518 | 517 | { |
519 | 518 | write_msg(NULL, "could not parse version string \"%s\"\n", PG_VERSION); |
520 | 519 | exit(1); |
521 | 520 | } |
522 | 521 |
|
| 522 | + /* |
| 523 | + * We allow the server to be back to 7.0, and up to any minor release |
| 524 | + * of our own major version. (See also version check in pg_dumpall.c.) |
| 525 | + */ |
| 526 | + g_fout->minRemoteVersion = 70000; |
| 527 | + g_fout->maxRemoteVersion = (my_version / 100) * 100 + 99; |
| 528 | + |
523 | 529 | /* |
524 | 530 | * Open the database using the Archiver, so it knows about it. Errors mean |
525 | 531 | * death. |
526 | 532 | */ |
527 | 533 | g_conn = ConnectDatabase(g_fout, dbname, pghost, pgport, |
528 | | - username, force_password, ignore_version); |
| 534 | + username, force_password); |
529 | 535 |
|
530 | 536 | /* Set the client encoding if requested */ |
531 | 537 | if (dumpencoding) |
@@ -739,7 +745,6 @@ help(const char *progname) |
739 | 745 | printf(_("\nGeneral options:\n")); |
740 | 746 | printf(_(" -f, --file=FILENAME output file name\n")); |
741 | 747 | printf(_(" -F, --format=c|t|p output file format (custom, tar, plain text)\n")); |
742 | | - printf(_(" -i, --ignore-version ignore server version mismatch\n")); |
743 | 748 | printf(_(" -v, --verbose verbose mode\n")); |
744 | 749 | printf(_(" -Z, --compress=0-9 compression level for compressed formats\n")); |
745 | 750 | printf(_(" --help show this help, then exit\n")); |
|
0 commit comments