Skip to content

Commit 6a2e19d

Browse files
committed
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.
1 parent 354547b commit 6a2e19d

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.180 2010/02/23 21:48:32 momjian Exp $
18+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.181 2010/02/24 02:42:54 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -304,15 +304,14 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
304304

305305
if (AH->public.verbose)
306306
{
307-
ahprintf(AH, "--\n-- pg_dump version: %s\n", PG_VERSION);
308-
ahprintf(AH, "--\n-- remote database version: %s (%d)\n"
309-
,AHX->remoteVersionStr
310-
,AHX->remoteVersion) ;
311-
ahprintf(AH, "--\n\n");
312-
}
313-
314-
if (AH->public.verbose)
307+
if (AH->archiveRemoteVersion)
308+
ahprintf(AH, "-- Dumped from database version %s\n",
309+
AH->archiveRemoteVersion);
310+
if (AH->archiveDumpVersion)
311+
ahprintf(AH, "-- Dumped by pg_dump version %s\n",
312+
AH->archiveDumpVersion);
315313
dumpTimestamp(AH, "Started on", AH->createDate);
314+
}
316315

317316
if (ropt->single_txn)
318317
{
@@ -1860,6 +1859,8 @@ _allocAH(const char *FileSpec, const ArchiveFormat fmt,
18601859
AH->public.exit_on_error = true;
18611860
AH->public.n_errors = 0;
18621861

1862+
AH->archiveDumpVersion = PG_VERSION;
1863+
18631864
AH->createDate = time(NULL);
18641865

18651866
AH->intSize = sizeof(int);
@@ -3059,7 +3060,6 @@ ReadHead(ArchiveHandle *AH)
30593060
AH->archiveRemoteVersion = ReadStr(AH);
30603061
AH->archiveDumpVersion = ReadStr(AH);
30613062
}
3062-
30633063
}
30643064

30653065

src/bin/pg_dump/pg_backup_db.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Implements the basic DB functions used by the archiver.
66
*
77
* IDENTIFICATION
8-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.88 2010/02/18 01:29:10 tgl Exp $
8+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.89 2010/02/24 02:42:55 tgl Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -64,6 +64,8 @@ _check_database_version(ArchiveHandle *AH)
6464

6565
AH->public.remoteVersionStr = strdup(remoteversion_str);
6666
AH->public.remoteVersion = remoteversion;
67+
if (!AH->archiveRemoteVersion)
68+
AH->archiveRemoteVersion = AH->public.remoteVersionStr;
6769

6870
if (myversion != remoteversion
6971
&& (remoteversion < AH->public.minRemoteVersion ||

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy