diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index c6e82c2947..e7889f0462 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -1,5 +1,5 @@
@@ -296,20 +296,7 @@ PostgreSQL documentation
- Ignore version mismatch between
- pg_dump and the database server.
-
-
-
- By default, pg_dump> will refuse to attempt
- to dump from a server that is of a newer PostgreSQL>
- version than pg_dump is. It will also
- refuse to attempt to dump from a server that is older than the oldest
- supported version (currently, 7.0). The
diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml
index 2dbf8524cf..a8715fbd7a 100644
--- a/doc/src/sgml/ref/pg_dumpall.sgml
+++ b/doc/src/sgml/ref/pg_dumpall.sgml
@@ -1,5 +1,5 @@
@@ -156,20 +156,7 @@ PostgreSQL documentation
- Ignore version mismatch between
- pg_dumpall and the database server.
-
-
-
- By default, pg_dumpall> will refuse to attempt
- to dump from a server that is of a newer PostgreSQL>
- version than pg_dumpall is. It will also
- refuse to attempt to dump from a server that is older than the oldest
- supported version (currently, 7.0). The
diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml
index edc5672c20..155c24b834 100644
--- a/doc/src/sgml/ref/pg_restore.sgml
+++ b/doc/src/sgml/ref/pg_restore.sgml
@@ -1,4 +1,4 @@
-
+
@@ -200,8 +200,7 @@
- Ignore version mismatch between
- pg_restore and the database server.
+ A deprecated option that is now ignored.
diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h
index c4eb6e22e4..ff4099fe4e 100644
--- a/src/bin/pg_dump/pg_backup.h
+++ b/src/bin/pg_dump/pg_backup.h
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.46 2008/03/20 17:36:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.47 2008/04/13 03:49:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -116,7 +116,6 @@ typedef struct _restoreOptions
char *pgport;
char *pghost;
char *username;
- int ignoreVersion;
int noDataForFailedTables;
int requirePassword;
int exit_on_error;
@@ -144,9 +143,7 @@ PGconn *ConnectDatabase(Archive *AH,
const char *pghost,
const char *pgport,
const char *username,
- const int reqPwd,
- const int ignoreVersion);
-
+ int reqPwd);
/* Called to add a TOC entry */
extern void ArchiveEntry(Archive *AHX,
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 7c36aef548..7a8588cdf6 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.153 2008/03/20 17:36:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.154 2008/04/13 03:49:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -162,7 +162,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
ConnectDatabase(AHX, ropt->dbname,
ropt->pghost, ropt->pgport, ropt->username,
- ropt->requirePassword, ropt->ignoreVersion);
+ ropt->requirePassword);
/*
* If we're talking to the DB directly, don't send comments since they
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index c426270eb8..4098ed9d27 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -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.78 2008/03/26 14:32:22 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.79 2008/04/13 03:49:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@
static const char *modulename = gettext_noop("archiver (db)");
-static void _check_database_version(ArchiveHandle *AH, bool ignoreVersion);
+static void _check_database_version(ArchiveHandle *AH);
static PGconn *_connectDB(ArchiveHandle *AH, const char *newdbname, const char *newUser);
static void notice_processor(void *arg, const char *message);
static char *_sendSQLLine(ArchiveHandle *AH, char *qry, char *eos);
@@ -48,7 +48,7 @@ _parse_version(ArchiveHandle *AH, const char *versionString)
}
static void
-_check_database_version(ArchiveHandle *AH, bool ignoreVersion)
+_check_database_version(ArchiveHandle *AH)
{
int myversion;
const char *remoteversion_str;
@@ -71,11 +71,7 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion)
{
write_msg(NULL, "server version: %s; %s version: %s\n",
remoteversion_str, progname, PG_VERSION);
- if (ignoreVersion)
- write_msg(NULL, "ignoring server version mismatch\n");
- else
- die_horribly(AH, NULL, "aborting because of server version mismatch\n"
- "Use the -i option to bypass server version check, but be prepared for failure.\n");
+ die_horribly(AH, NULL, "aborting because of server version mismatch\n");
}
}
@@ -182,7 +178,7 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, const char *requser)
free(password);
/* check for version mismatch */
- _check_database_version(AH, true);
+ _check_database_version(AH);
PQsetNoticeProcessor(newConn, notice_processor, NULL);
@@ -201,8 +197,7 @@ ConnectDatabase(Archive *AHX,
const char *pghost,
const char *pgport,
const char *username,
- const int reqPwd,
- const int ignoreVersion)
+ int reqPwd)
{
ArchiveHandle *AH = (ArchiveHandle *) AHX;
char *password = NULL;
@@ -254,7 +249,7 @@ ConnectDatabase(Archive *AHX,
PQdb(AH->connection), PQerrorMessage(AH->connection));
/* check for version mismatch */
- _check_database_version(AH, ignoreVersion);
+ _check_database_version(AH);
PQsetNoticeProcessor(AH->connection, notice_processor, NULL);
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index acd23f02e8..d32048d0ec 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.486 2008/03/28 00:21:56 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.487 2008/04/13 03:49:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -211,19 +211,20 @@ main(int argc, char **argv)
int i;
bool force_password = false;
int compressLevel = -1;
- bool ignore_version = false;
int plainText = 0;
int outputClean = 0;
int outputCreate = 0;
bool outputBlobs = false;
int outputNoOwner = 0;
char *outputSuperuser = NULL;
+ int my_version;
+ int optindex;
+ RestoreOptions *ropt;
+
static int disable_triggers = 0;
static int outputNoTablespaces = 0;
static int use_setsessauth = 0;
- RestoreOptions *ropt;
-
static struct option long_options[] = {
{"data-only", no_argument, NULL, 'a'},
{"blobs", no_argument, NULL, 'b'},
@@ -266,7 +267,6 @@ main(int argc, char **argv)
{NULL, 0, NULL, 0}
};
- int optindex;
set_pglocale_pgservice(argv[0], "pg_dump");
@@ -345,8 +345,8 @@ main(int argc, char **argv)
pghost = optarg;
break;
- case 'i': /* ignore database version mismatch */
- ignore_version = true;
+ case 'i':
+ /* ignored, deprecated option */
break;
case 'n': /* include schema(s) */
@@ -512,20 +512,26 @@ main(int argc, char **argv)
/* Let the archiver know how noisy to be */
g_fout->verbose = g_verbose;
- g_fout->minRemoteVersion = 70000; /* we can handle back to 7.0 */
- g_fout->maxRemoteVersion = parse_version(PG_VERSION);
- if (g_fout->maxRemoteVersion < 0)
+ my_version = parse_version(PG_VERSION);
+ if (my_version < 0)
{
write_msg(NULL, "could not parse version string \"%s\"\n", PG_VERSION);
exit(1);
}
+ /*
+ * We allow the server to be back to 7.0, and up to any minor release
+ * of our own major version. (See also version check in pg_dumpall.c.)
+ */
+ g_fout->minRemoteVersion = 70000;
+ g_fout->maxRemoteVersion = (my_version / 100) * 100 + 99;
+
/*
* Open the database using the Archiver, so it knows about it. Errors mean
* death.
*/
g_conn = ConnectDatabase(g_fout, dbname, pghost, pgport,
- username, force_password, ignore_version);
+ username, force_password);
/* Set the client encoding if requested */
if (dumpencoding)
@@ -739,7 +745,6 @@ help(const char *progname)
printf(_("\nGeneral options:\n"));
printf(_(" -f, --file=FILENAME output file name\n"));
printf(_(" -F, --format=c|t|p output file format (custom, tar, plain text)\n"));
- printf(_(" -i, --ignore-version ignore server version mismatch\n"));
printf(_(" -v, --verbose verbose mode\n"));
printf(_(" -Z, --compress=0-9 compression level for compressed formats\n"));
printf(_(" --help show this help, then exit\n"));
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 921580ea29..7d3affbc8f 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.103 2008/03/26 14:32:22 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.104 2008/04/13 03:49:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -60,7 +60,6 @@ static PQExpBuffer pgdumpopts;
static bool output_clean = false;
static bool skip_acls = false;
static bool verbose = false;
-static bool ignoreVersion = false;
static int disable_dollar_quoting = 0;
static int disable_triggers = 0;
@@ -214,8 +213,7 @@ main(int argc, char *argv[])
break;
case 'i':
- ignoreVersion = true;
- appendPQExpBuffer(pgdumpopts, " -i");
+ /* ignored, deprecated option */
break;
case 'l':
@@ -488,7 +486,6 @@ help(void)
printf(_("\nGeneral options:\n"));
printf(_(" -f, --file=FILENAME output file name\n"));
- printf(_(" -i, --ignore-version ignore server version mismatch\n"));
printf(_(" --help show this help, then exit\n"));
printf(_(" --version output version information, then exit\n"));
printf(_("\nOptions controlling the output content:\n"));
@@ -1391,20 +1388,18 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport,
exit(1);
}
+ /*
+ * We allow the server to be back to 7.0, and up to any minor release
+ * of our own major version. (See also version check in pg_dump.c.)
+ */
if (my_version != server_version
- && (server_version < 70000 /* we can handle back to 7.0 */
- || server_version > my_version))
+ && (server_version < 70000 ||
+ (server_version / 100) > (my_version / 100)))
{
fprintf(stderr, _("server version: %s; %s version: %s\n"),
remoteversion_str, progname, PG_VERSION);
- if (ignoreVersion)
- fprintf(stderr, _("ignoring server version mismatch\n"));
- else
- {
- fprintf(stderr, _("aborting because of server version mismatch\n"
- "Use the -i option to bypass server version check, but be prepared for failure.\n"));
- exit(1);
- }
+ fprintf(stderr, _("aborting because of server version mismatch\n"));
+ exit(1);
}
/*
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index 05da3526cf..89eb3b4371 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -34,7 +34,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.87 2008/03/26 14:32:22 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.88 2008/04/13 03:49:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -171,7 +171,7 @@ main(int argc, char **argv)
opts->pghost = strdup(optarg);
break;
case 'i':
- opts->ignoreVersion = 1;
+ /* ignored, deprecated option */
break;
case 'l': /* Dump the TOC summary */
@@ -378,7 +378,6 @@ usage(const char *progname)
printf(_(" -d, --dbname=NAME connect to database name\n"));
printf(_(" -f, --file=FILENAME output file name\n"));
printf(_(" -F, --format=c|t specify backup file format\n"));
- printf(_(" -i, --ignore-version ignore server version mismatch\n"));
printf(_(" -l, --list print summarized TOC of the archive\n"));
printf(_(" -v, --verbose verbose mode\n"));
printf(_(" --help show this help, then exit\n"));