|
15 | 15 | * |
16 | 16 | * |
17 | 17 | * IDENTIFICATION |
18 | | - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.24 2001/04/14 13:11:03 pjw Exp $ |
| 18 | + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.25 2001/04/25 07:03:19 pjw Exp $ |
19 | 19 | * |
20 | 20 | * Modifications - 28-Jun-2000 - pjw@rhyme.com.au |
21 | 21 | * |
@@ -169,6 +169,10 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) |
169 | 169 | if (AH->version < K_VERS_1_3) |
170 | 170 | die_horribly(AH, "Direct database connections are not supported in pre-1.3 archives"); |
171 | 171 |
|
| 172 | + /* XXX Should get this from the archive */ |
| 173 | + AHX->minRemoteVersion = 070100; |
| 174 | + AHX->maxRemoteVersion = 999999; |
| 175 | + |
172 | 176 | ConnectDatabase(AHX, ropt->dbname, ropt->pghost, ropt->pgport, |
173 | 177 | ropt->requirePassword, ropt->ignoreVersion); |
174 | 178 |
|
@@ -260,6 +264,18 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) |
260 | 264 | /* Work out what, if anything, we want from this entry */ |
261 | 265 | reqs = _tocEntryRequired(te, ropt); |
262 | 266 |
|
| 267 | + /* Dump any relevant dump warnings to stderr */ |
| 268 | + if (!ropt->suppressDumpWarnings && strcmp(te->desc, "WARNING") == 0) |
| 269 | + { |
| 270 | + if (!ropt->dataOnly && te->defn != NULL && strlen(te->defn) != 0) |
| 271 | + { |
| 272 | + fprintf(stderr, "%s: Warning from original dump file:\n%s\n", progname, te->defn); |
| 273 | + } else if (te->copyStmt != NULL && strlen(te->copyStmt) != 0) |
| 274 | + { |
| 275 | + fprintf(stderr, "%s: Warning from original dump file:\n%s\n", progname, te->copyStmt); |
| 276 | + } |
| 277 | + } |
| 278 | + |
263 | 279 | if ((reqs & 1) != 0) /* We want the schema */ |
264 | 280 | { |
265 | 281 | /* Reconnect if necessary */ |
@@ -405,6 +421,7 @@ NewRestoreOptions(void) |
405 | 421 | opts = (RestoreOptions *) calloc(1, sizeof(RestoreOptions)); |
406 | 422 |
|
407 | 423 | opts->format = archUnknown; |
| 424 | + opts->suppressDumpWarnings = false; |
408 | 425 |
|
409 | 426 | return opts; |
410 | 427 | } |
@@ -1419,7 +1436,8 @@ _discoverArchiveFormat(ArchiveHandle *AH) |
1419 | 1436 | cnt = fread(sig, 1, 5, fh); |
1420 | 1437 |
|
1421 | 1438 | if (cnt != 5) |
1422 | | - die_horribly(AH, "%s: input file is too short, or is unreadable\n", progname); |
| 1439 | + die_horribly(AH, "%s: input file is too short, or is unreadable (read %d, expected 5)\n", |
| 1440 | + progname, cnt); |
1423 | 1441 |
|
1424 | 1442 | /* Save it, just in case we need it later */ |
1425 | 1443 | strncpy(&AH->lookahead[0], sig, 5); |
|
0 commit comments