Fix patch for printing backend and pg_dump versions so that it works in

a desirable fashion in archive-dump cases, ie you should get the pg_dump
version not the pg_restore version.
This commit is contained in:
Tom Lane 2010-02-24 02:42:55 +00:00
parent 354547b015
commit 6a2e19d96d
2 changed files with 13 additions and 11 deletions

View File

@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.180 2010/02/23 21:48:32 momjian Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.181 2010/02/24 02:42:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -304,15 +304,14 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
if (AH->public.verbose)
{
ahprintf(AH, "--\n-- pg_dump version: %s\n", PG_VERSION);
ahprintf(AH, "--\n-- remote database version: %s (%d)\n"
,AHX->remoteVersionStr
,AHX->remoteVersion) ;
ahprintf(AH, "--\n\n");
}
if (AH->public.verbose)
if (AH->archiveRemoteVersion)
ahprintf(AH, "-- Dumped from database version %s\n",
AH->archiveRemoteVersion);
if (AH->archiveDumpVersion)
ahprintf(AH, "-- Dumped by pg_dump version %s\n",
AH->archiveDumpVersion);
dumpTimestamp(AH, "Started on", AH->createDate);
}
if (ropt->single_txn)
{
@ -1860,6 +1859,8 @@ _allocAH(const char *FileSpec, const ArchiveFormat fmt,
AH->public.exit_on_error = true;
AH->public.n_errors = 0;
AH->archiveDumpVersion = PG_VERSION;
AH->createDate = time(NULL);
AH->intSize = sizeof(int);
@ -3059,7 +3060,6 @@ ReadHead(ArchiveHandle *AH)
AH->archiveRemoteVersion = ReadStr(AH);
AH->archiveDumpVersion = ReadStr(AH);
}
}

View File

@ -5,7 +5,7 @@
* Implements the basic DB functions used by the archiver.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.88 2010/02/18 01:29:10 tgl Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.89 2010/02/24 02:42:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -64,6 +64,8 @@ _check_database_version(ArchiveHandle *AH)
AH->public.remoteVersionStr = strdup(remoteversion_str);
AH->public.remoteVersion = remoteversion;
if (!AH->archiveRemoteVersion)
AH->archiveRemoteVersion = AH->public.remoteVersionStr;
if (myversion != remoteversion
&& (remoteversion < AH->public.minRemoteVersion ||