Remove pg_dump/pg_dumpall support for dumping from pre-8.0 servers.
authorTom Lane <[email protected]>
Wed, 12 Oct 2016 16:19:56 +0000 (12:19 -0400)
committerTom Lane <[email protected]>
Wed, 12 Oct 2016 16:20:02 +0000 (12:20 -0400)
The need for dumping from such ancient servers has decreased to about nil
in the field, so let's remove all the code that catered to it.  Aside
from removing a lot of boilerplate variant queries, this allows us to not
have to cope with servers that don't have (a) schemas or (b) pg_depend.
That means we can get rid of assorted squishy code around that.  There
may be some nonobvious additional simplifications possible, but this patch
already removes about 1500 lines of code.

I did not remove the ability for pg_restore to read custom-format archives
generated by these old versions (and light testing says that that does
still work).  If you have an old server, you probably also have a pg_dump
that will work with it; but you have an old custom-format backup file,
that might be all you have.

It'd be possible at this point to remove fmtQualifiedId()'s version
argument, but I refrained since that would affect code outside pg_dump.

Discussion: <2661.1475849167@sss.pgh.pa.us>

doc/src/sgml/ref/pg_dump.sgml
src/bin/pg_dump/dumputils.c
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/bin/pg_dump/pg_dump_sort.c
src/bin/pg_dump/pg_dumpall.c

index be1b684082d85bad03aadaadd8dda962cbeb8891..371a61427d646d33e1b29bb8022dd42d765451c5 100644 (file)
@@ -758,10 +758,9 @@ PostgreSQL documentation
         the dump. Instead fail if unable to lock a table within the specified
         <replaceable class="parameter">timeout</>. The timeout may be
         specified in any of the formats accepted by <command>SET
-        statement_timeout</>.  (Allowed values vary depending on the server
+        statement_timeout</>.  (Allowed formats vary depending on the server
         version you are dumping from, but an integer number of milliseconds
-        is accepted by all versions since 7.3.  This option is ignored when
-        dumping from a pre-7.3 server.)
+        is accepted by all versions.)
        </para>
       </listitem>
      </varlistentry>
@@ -1172,7 +1171,7 @@ CREATE DATABASE foo WITH TEMPLATE template0;
    <productname>PostgreSQL</> server versions newer than
    <application>pg_dump</>'s version.  <application>pg_dump</> can also
    dump from <productname>PostgreSQL</> servers older than its own version.
-   (Currently, servers back to version 7.0 are supported.)
+   (Currently, servers back to version 8.0 are supported.)
    However, <application>pg_dump</> cannot dump from
    <productname>PostgreSQL</> servers newer than its own major version;
    it will refuse to even try, rather than risk making an invalid dump.
index cd1e8c4a680adee7be9c4d072f9e6a71bf96e5e0..0d5166891e87e9fdce81bb2e694b3ea451d89458 100644 (file)
@@ -18,8 +18,6 @@
 #include "fe_utils/string_utils.h"
 
 
-#define supports_grant_options(version) ((version) >= 70400)
-
 static bool parseAclItem(const char *item, const char *type,
                         const char *name, const char *subname, int remoteVersion,
                         PQExpBuffer grantee, PQExpBuffer grantor,
@@ -246,11 +244,9 @@ buildACLCommands(const char *name, const char *subname,
 
                                /*
                                 * For the owner, the default privilege level is ALL WITH
-                                * GRANT OPTION (only ALL prior to 7.4).
+                                * GRANT OPTION.
                                 */
-                               if (supports_grant_options(remoteVersion)
-                                       ? strcmp(privswgo->data, "ALL") != 0
-                                       : strcmp(privs->data, "ALL") != 0)
+                               if (strcmp(privswgo->data, "ALL") != 0)
                                {
                                        appendPQExpBuffer(firstsql, "%sREVOKE ALL", prefix);
                                        if (subname)
@@ -403,16 +399,19 @@ buildDefaultACLCommands(const char *type, const char *nspname,
  *             username=privilegecodes/grantor
  * or
  *             group groupname=privilegecodes/grantor
- * (the /grantor part will not be present if pre-7.4 database).
+ * (the "group" case occurs only with servers before 8.1).
+ *
+ * Returns true on success, false on parse error.  On success, the components
+ * of the string are returned in the PQExpBuffer parameters.
  *
  * The returned grantee string will be the dequoted username or groupname
- * (preceded with "group " in the latter case).  The returned grantor is
- * the dequoted grantor name or empty.  Privilege characters are decoded
- * and split between privileges with grant option (privswgo) and without
- * (privs).
+ * (preceded with "group " in the latter case).  Note that a grant to PUBLIC
+ * is represented by an empty grantee string.  The returned grantor is the
+ * dequoted grantor name.  Privilege characters are decoded and split between
+ * privileges with grant option (privswgo) and without (privs).
  *
- * Note: for cross-version compatibility, it's important to use ALL when
- * appropriate.
+ * Note: for cross-version compatibility, it's important to use ALL to
+ * represent the privilege sets whenever appropriate.
  */
 static bool
 parseAclItem(const char *item, const char *type,
@@ -439,7 +438,7 @@ parseAclItem(const char *item, const char *type,
                return false;
        }
 
-       /* grantor may be listed after / */
+       /* grantor should appear after / */
        slpos = strchr(eqpos + 1, '/');
        if (slpos)
        {
@@ -452,7 +451,10 @@ parseAclItem(const char *item, const char *type,
                }
        }
        else
-               resetPQExpBuffer(grantor);
+       {
+               free(buf);
+               return false;
+       }
 
        /* privilege codes */
 #define CONVERT_PRIV(code, keywd) \
@@ -490,29 +492,19 @@ do { \
                {
                        /* table only */
                        CONVERT_PRIV('a', "INSERT");
-                       if (remoteVersion >= 70200)
-                               CONVERT_PRIV('x', "REFERENCES");
+                       CONVERT_PRIV('x', "REFERENCES");
                        /* rest are not applicable to columns */
                        if (subname == NULL)
                        {
-                               if (remoteVersion >= 70200)
-                               {
-                                       CONVERT_PRIV('d', "DELETE");
-                                       CONVERT_PRIV('t', "TRIGGER");
-                               }
+                               CONVERT_PRIV('d', "DELETE");
+                               CONVERT_PRIV('t', "TRIGGER");
                                if (remoteVersion >= 80400)
                                        CONVERT_PRIV('D', "TRUNCATE");
                        }
                }
 
                /* UPDATE */
-               if (remoteVersion >= 70200 ||
-                       strcmp(type, "SEQUENCE") == 0 ||
-                       strcmp(type, "SEQUENCES") == 0)
-                       CONVERT_PRIV('w', "UPDATE");
-               else
-                       /* 7.0 and 7.1 have a simpler worldview */
-                       CONVERT_PRIV('w', "UPDATE,DELETE");
+               CONVERT_PRIV('w', "UPDATE");
        }
        else if (strcmp(type, "FUNCTION") == 0 ||
                         strcmp(type, "FUNCTIONS") == 0)
index bba8b6ca9f90813e5193b8e9ba785eef37679eae..e237b4a9c901f0595849e5f78a18cf0ef4d64c7a 100644 (file)
@@ -388,7 +388,7 @@ RestoreArchive(Archive *AHX)
                 * target.
                 */
                AHX->minRemoteVersion = 0;
-               AHX->maxRemoteVersion = 999999;
+               AHX->maxRemoteVersion = 9999999;
 
                ConnectDatabase(AHX, ropt->dbname,
                                                ropt->pghost, ropt->pgport, ropt->username,
index fde7f59c3d03d9f0fa9cee0abaf74b088f487fef..c821f3b0ee199514be8a59aa08cc923b82c3180f 100644 (file)
@@ -96,9 +96,6 @@ bool          g_verbose;                      /* User wants verbose narration of our
 /* subquery used to convert user ID (eg, datdba) to user name */
 static const char *username_subquery;
 
-/* obsolete as of 7.3: */
-static Oid     g_last_builtin_oid; /* value of the last builtin oid */
-
 /* The specified names/patterns should to match at least one entity */
 static int     strict_names = 0;
 
@@ -142,7 +139,7 @@ static void expand_table_name_patterns(Archive *fout,
                                                   SimpleStringList *patterns,
                                                   SimpleOidList *oids,
                                                   bool strict_names);
-static NamespaceInfo *findNamespace(Archive *fout, Oid nsoid, Oid objoid);
+static NamespaceInfo *findNamespace(Archive *fout, Oid nsoid);
 static void dumpTableData(Archive *fout, TableDataInfo *tdinfo);
 static void refreshMatViewData(Archive *fout, TableDataInfo *tdinfo);
 static void guessConstraintInheritance(TableInfo *tblinfo, int numTables);
@@ -236,11 +233,8 @@ static char *convertRegProcReference(Archive *fout,
                                                const char *proc);
 static char *convertOperatorReference(Archive *fout, const char *opr);
 static char *convertTSFunction(Archive *fout, Oid funcOid);
-static Oid     findLastBuiltinOid_V71(Archive *fout, const char *);
-static Oid     findLastBuiltinOid_V70(Archive *fout);
 static void selectSourceSchema(Archive *fout, const char *schemaName);
 static char *getFormattedTypeName(Archive *fout, Oid oid, OidOptions opts);
-static char *myFormatType(const char *typname, int32 typmod);
 static void getBlobs(Archive *fout);
 static void dumpBlob(Archive *fout, BlobInfo *binfo);
 static int     dumpBlobs(Archive *fout, void *arg);
@@ -633,10 +627,10 @@ main(int argc, char **argv)
        fout->verbose = g_verbose;
 
        /*
-        * We allow the server to be back to 7.0, and up to any minor release of
+        * We allow the server to be back to 8.0, and up to any minor release of
         * our own major version.  (See also version check in pg_dumpall.c.)
         */
-       fout->minRemoteVersion = 70000;
+       fout->minRemoteVersion = 80000;
        fout->maxRemoteVersion = (PG_VERSION_NUM / 100) * 100 + 99;
 
        fout->numWorkers = numWorkers;
@@ -665,10 +659,8 @@ main(int argc, char **argv)
        /* Select the appropriate subquery to convert user IDs to names */
        if (fout->remoteVersion >= 80100)
                username_subquery = "SELECT rolname FROM pg_catalog.pg_roles WHERE oid =";
-       else if (fout->remoteVersion >= 70300)
-               username_subquery = "SELECT usename FROM pg_catalog.pg_user WHERE usesysid =";
        else
-               username_subquery = "SELECT usename FROM pg_user WHERE usesysid =";
+               username_subquery = "SELECT usename FROM pg_catalog.pg_user WHERE usesysid =";
 
        /* check the version for the synchronized snapshots feature */
        if (numWorkers > 1 && fout->remoteVersion < 90200
@@ -683,18 +675,6 @@ main(int argc, char **argv)
                exit_horribly(NULL,
                   "Exported snapshots are not supported by this server version.\n");
 
-       /* Find the last built-in OID, if needed */
-       if (fout->remoteVersion < 70300)
-       {
-               if (fout->remoteVersion >= 70100)
-                       g_last_builtin_oid = findLastBuiltinOid_V71(fout,
-                                                                                                 PQdb(GetConnection(fout)));
-               else
-                       g_last_builtin_oid = findLastBuiltinOid_V70(fout);
-               if (g_verbose)
-                       write_msg(NULL, "last built-in OID is %u\n", g_last_builtin_oid);
-       }
-
        /* Expand schema selection patterns into OID lists */
        if (schema_include_patterns.head != NULL)
        {
@@ -774,16 +754,11 @@ main(int argc, char **argv)
        /*
         * Sort the objects into a safe dump order (no forward references).
         *
-        * In 7.3 or later, we can rely on dependency information to help us
-        * determine a safe order, so the initial sort is mostly for cosmetic
-        * purposes: we sort by name to ensure that logically identical schemas
-        * will dump identically.  Before 7.3 we don't have dependencies and we
-        * use OID ordering as an (unreliable) guide to creation order.
+        * We rely on dependency information to help us determine a safe order, so
+        * the initial sort is mostly for cosmetic purposes: we sort by name to
+        * ensure that logically identical schemas will dump identically.
         */
-       if (fout->remoteVersion >= 70300)
-               sortDumpableObjectsByTypeName(dobjs, numObjs);
-       else
-               sortDumpableObjectsByTypeOid(dobjs, numObjs);
+       sortDumpableObjectsByTypeName(dobjs, numObjs);
 
        /* If we do a parallel dump, we want the largest tables to go first */
        if (archiveFormat == archDirectory && numWorkers > 1)
@@ -1000,12 +975,12 @@ setup_connection(Archive *AH, const char *dumpencoding,
                ExecuteSqlStatement(AH, "SET INTERVALSTYLE = POSTGRES");
 
        /*
-        * If supported, set extra_float_digits so that we can dump float data
-        * exactly (given correctly implemented float I/O code, anyway)
+        * Set extra_float_digits so that we can dump float data exactly (given
+        * correctly implemented float I/O code, anyway)
         */
        if (AH->remoteVersion >= 90000)
                ExecuteSqlStatement(AH, "SET extra_float_digits TO 3");
-       else if (AH->remoteVersion >= 70400)
+       else
                ExecuteSqlStatement(AH, "SET extra_float_digits TO 2");
 
        /*
@@ -1018,8 +993,7 @@ setup_connection(Archive *AH, const char *dumpencoding,
        /*
         * Disable timeouts if supported.
         */
-       if (AH->remoteVersion >= 70300)
-               ExecuteSqlStatement(AH, "SET statement_timeout = 0");
+       ExecuteSqlStatement(AH, "SET statement_timeout = 0");
        if (AH->remoteVersion >= 90300)
                ExecuteSqlStatement(AH, "SET lock_timeout = 0");
        if (AH->remoteVersion >= 90600)
@@ -1065,16 +1039,12 @@ setup_connection(Archive *AH, const char *dumpencoding,
                                                                "SET TRANSACTION ISOLATION LEVEL "
                                                                "REPEATABLE READ, READ ONLY");
        }
-       else if (AH->remoteVersion >= 70400)
+       else
        {
-               /* note: comma was not accepted in SET TRANSACTION before 8.0 */
                ExecuteSqlStatement(AH,
                                                        "SET TRANSACTION ISOLATION LEVEL "
-                                                       "SERIALIZABLE READ ONLY");
+                                                       "SERIALIZABLE, READ ONLY");
        }
-       else
-               ExecuteSqlStatement(AH,
-                                                       "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE");
 
        /*
         * If user specified a snapshot to use, select that.  In a parallel dump
@@ -1190,9 +1160,6 @@ expand_schema_name_patterns(Archive *fout,
        if (patterns->head == NULL)
                return;                                 /* nothing to do */
 
-       if (fout->remoteVersion < 70300)
-               exit_horribly(NULL, "server version must be at least 7.3 to use schema selection switches\n");
-
        query = createPQExpBuffer();
 
        /*
@@ -1661,15 +1628,12 @@ dumpTableData_copy(Archive *fout, void *dcontext)
        selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name);
 
        /*
-        * If possible, specify the column list explicitly so that we have no
-        * possibility of retrieving data in the wrong column order.  (The default
-        * column ordering of COPY will not be what we want in certain corner
-        * cases involving ADD COLUMN and inheritance.)
+        * Specify the column list explicitly so that we have no possibility of
+        * retrieving data in the wrong column order.  (The default column
+        * ordering of COPY will not be what we want in certain corner cases
+        * involving ADD COLUMN and inheritance.)
         */
-       if (fout->remoteVersion >= 70300)
-               column_list = fmtCopyColumnList(tbinfo, clistBuf);
-       else
-               column_list = "";               /* can't select columns in COPY */
+       column_list = fmtCopyColumnList(tbinfo, clistBuf);
 
        if (oids && hasoids)
        {
@@ -1829,22 +1793,11 @@ dumpTableData_insert(Archive *fout, void *dcontext)
         */
        selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name);
 
-       if (fout->remoteVersion >= 70100)
-       {
-               appendPQExpBuffer(q, "DECLARE _pg_dump_cursor CURSOR FOR "
-                                                 "SELECT * FROM ONLY %s",
-                                                 fmtQualifiedId(fout->remoteVersion,
-                                                                                tbinfo->dobj.namespace->dobj.name,
-                                                                                classname));
-       }
-       else
-       {
-               appendPQExpBuffer(q, "DECLARE _pg_dump_cursor CURSOR FOR "
-                                                 "SELECT * FROM %s",
-                                                 fmtQualifiedId(fout->remoteVersion,
-                                                                                tbinfo->dobj.namespace->dobj.name,
-                                                                                classname));
-       }
+       appendPQExpBuffer(q, "DECLARE _pg_dump_cursor CURSOR FOR "
+                                         "SELECT * FROM ONLY %s",
+                                         fmtQualifiedId(fout->remoteVersion,
+                                                                        tbinfo->dobj.namespace->dobj.name,
+                                                                        classname));
        if (tdinfo->filtercond)
                appendPQExpBuffer(q, " %s", tdinfo->filtercond);
 
@@ -2480,7 +2433,7 @@ dumpDatabase(Archive *fout)
                                                  username_subquery);
                appendStringLiteralAH(dbQry, datname, fout);
        }
-       else if (fout->remoteVersion >= 80000)
+       else
        {
                appendPQExpBuffer(dbQry, "SELECT tableoid, oid, "
                                                  "(%s datdba) AS dba, "
@@ -2492,34 +2445,6 @@ dumpDatabase(Archive *fout)
                                                  username_subquery);
                appendStringLiteralAH(dbQry, datname, fout);
        }
-       else if (fout->remoteVersion >= 70100)
-       {
-               appendPQExpBuffer(dbQry, "SELECT tableoid, oid, "
-                                                 "(%s datdba) AS dba, "
-                                                 "pg_encoding_to_char(encoding) AS encoding, "
-                                                 "NULL AS datcollate, NULL AS datctype, "
-                                                 "0 AS datfrozenxid, 0 AS datminmxid, "
-                                                 "NULL AS tablespace "
-                                                 "FROM pg_database "
-                                                 "WHERE datname = ",
-                                                 username_subquery);
-               appendStringLiteralAH(dbQry, datname, fout);
-       }
-       else
-       {
-               appendPQExpBuffer(dbQry, "SELECT "
-                                                 "(SELECT oid FROM pg_class WHERE relname = 'pg_database') AS tableoid, "
-                                                 "oid, "
-                                                 "(%s datdba) AS dba, "
-                                                 "pg_encoding_to_char(encoding) AS encoding, "
-                                                 "NULL AS datcollate, NULL AS datctype, "
-                                                 "0 AS datfrozenxid, 0 AS datminmxid, "
-                                                 "NULL AS tablespace "
-                                                 "FROM pg_database "
-                                                 "WHERE datname = ",
-                                                 username_subquery);
-               appendStringLiteralAH(dbQry, datname, fout);
-       }
 
        res = ExecuteSqlQueryForSingleRow(fout, dbQry->data);
 
@@ -2879,19 +2804,13 @@ getBlobs(Archive *fout)
                                                  "NULL AS initrlomacl "
                                                  " FROM pg_largeobject_metadata",
                                                  username_subquery);
-       else if (fout->remoteVersion >= 70100)
+       else
                appendPQExpBufferStr(blobQry,
                                                         "SELECT DISTINCT loid AS oid, "
                                                         "NULL::name AS rolname, NULL::oid AS lomacl, "
                                                         "NULL::oid AS rlomacl, NULL::oid AS initlomacl, "
                                                         "NULL::oid AS initrlomacl "
                                                         " FROM pg_largeobject");
-       else
-               appendPQExpBufferStr(blobQry,
-                                                        "SELECT oid, NULL AS rolname, NULL AS lomacl, "
-                                                        "NULL AS rlomacl, NULL AS initlomacl, "
-                                                        "NULL AS initrlomacl "
-                                                        " FROM pg_class WHERE relkind = 'l'");
 
        res = ExecuteSqlQuery(fout, blobQry->data, PGRES_TUPLES_OK);
 
@@ -3031,10 +2950,8 @@ dumpBlobs(Archive *fout, void *arg)
         */
        if (fout->remoteVersion >= 90000)
                blobQry = "DECLARE bloboid CURSOR FOR SELECT oid FROM pg_largeobject_metadata";
-       else if (fout->remoteVersion >= 70100)
-               blobQry = "DECLARE bloboid CURSOR FOR SELECT DISTINCT loid FROM pg_largeobject";
        else
-               blobQry = "DECLARE bloboid CURSOR FOR SELECT oid FROM pg_class WHERE relkind = 'l'";
+               blobQry = "DECLARE bloboid CURSOR FOR SELECT DISTINCT loid FROM pg_largeobject";
 
        ExecuteSqlStatement(fout, blobQry);
 
@@ -3536,45 +3453,6 @@ getNamespaces(Archive *fout, int *numNamespaces)
        int                     i_initnspacl;
        int                     i_initrnspacl;
 
-       /*
-        * Before 7.3, there are no real namespaces; create two dummy entries, one
-        * for user stuff and one for system stuff.
-        */
-       if (fout->remoteVersion < 70300)
-       {
-               nsinfo = (NamespaceInfo *) pg_malloc(2 * sizeof(NamespaceInfo));
-
-               nsinfo[0].dobj.objType = DO_NAMESPACE;
-               nsinfo[0].dobj.catId.tableoid = 0;
-               nsinfo[0].dobj.catId.oid = 0;
-               AssignDumpId(&nsinfo[0].dobj);
-               nsinfo[0].dobj.name = pg_strdup("public");
-               nsinfo[0].rolname = pg_strdup("");
-               nsinfo[0].nspacl = pg_strdup("");
-               nsinfo[0].rnspacl = pg_strdup("");
-               nsinfo[0].initnspacl = pg_strdup("");
-               nsinfo[0].initrnspacl = pg_strdup("");
-
-               selectDumpableNamespace(&nsinfo[0], fout);
-
-               nsinfo[1].dobj.objType = DO_NAMESPACE;
-               nsinfo[1].dobj.catId.tableoid = 0;
-               nsinfo[1].dobj.catId.oid = 1;
-               AssignDumpId(&nsinfo[1].dobj);
-               nsinfo[1].dobj.name = pg_strdup("pg_catalog");
-               nsinfo[1].rolname = pg_strdup("");
-               nsinfo[1].nspacl = pg_strdup("");
-               nsinfo[1].rnspacl = pg_strdup("");
-               nsinfo[1].initnspacl = pg_strdup("");
-               nsinfo[1].initrnspacl = pg_strdup("");
-
-               selectDumpableNamespace(&nsinfo[1], fout);
-
-               *numNamespaces = 2;
-
-               return nsinfo;
-       }
-
        query = createPQExpBuffer();
 
        /* Make sure we are in proper schema */
@@ -3684,37 +3562,16 @@ getNamespaces(Archive *fout, int *numNamespaces)
 
 /*
  * findNamespace:
- *             given a namespace OID and an object OID, look up the info read by
- *             getNamespaces
- *
- * NB: for pre-7.3 source database, we use object OID to guess whether it's
- * a system object or not.  In 7.3 and later there is no guessing, and we
- * don't use objoid at all.
+ *             given a namespace OID, look up the info read by getNamespaces
  */
 static NamespaceInfo *
-findNamespace(Archive *fout, Oid nsoid, Oid objoid)
+findNamespace(Archive *fout, Oid nsoid)
 {
        NamespaceInfo *nsinfo;
 
-       if (fout->remoteVersion >= 70300)
-       {
-               nsinfo = findNamespaceByOid(nsoid);
-       }
-       else
-       {
-               /* This code depends on the dummy objects set up by getNamespaces. */
-               Oid                     i;
-
-               if (objoid > g_last_builtin_oid)
-                       i = 0;                          /* user object */
-               else
-                       i = 1;                          /* system object */
-               nsinfo = findNamespaceByOid(i);
-       }
-
+       nsinfo = findNamespaceByOid(nsoid);
        if (nsinfo == NULL)
                exit_horribly(NULL, "schema with OID %u does not exist\n", nsoid);
-
        return nsinfo;
 }
 
@@ -3932,7 +3789,7 @@ getTypes(Archive *fout, int *numTypes)
                                                  "FROM pg_type",
                                                  username_subquery);
        }
-       else if (fout->remoteVersion >= 70300)
+       else
        {
                appendPQExpBuffer(query, "SELECT tableoid, oid, typname, "
                                                  "typnamespace, NULL AS typacl, NULL as rtypacl, "
@@ -3947,38 +3804,6 @@ getTypes(Archive *fout, int *numTypes)
                                                  "FROM pg_type",
                                                  username_subquery);
        }
-       else if (fout->remoteVersion >= 70100)
-       {
-               appendPQExpBuffer(query, "SELECT tableoid, oid, typname, "
-                                 "0::oid AS typnamespace, NULL AS typacl, NULL as rtypacl, "
-                                                 "NULL AS inittypacl, NULL AS initrtypacl, "
-                                                 "(%s typowner) AS rolname, "
-                                                 "typinput::oid AS typinput, "
-                                                 "typoutput::oid AS typoutput, typelem, typrelid, "
-                                                 "CASE WHEN typrelid = 0 THEN ' '::\"char\" "
-                                                 "ELSE (SELECT relkind FROM pg_class WHERE oid = typrelid) END AS typrelkind, "
-                                                 "typtype, typisdefined, "
-                                                 "typname[0] = '_' AND typelem != 0 AS isarray "
-                                                 "FROM pg_type",
-                                                 username_subquery);
-       }
-       else
-       {
-               appendPQExpBuffer(query, "SELECT "
-                "(SELECT oid FROM pg_class WHERE relname = 'pg_type') AS tableoid, "
-                                                 "oid, typname, "
-                                 "0::oid AS typnamespace, NULL AS typacl, NULL as rtypacl, "
-                                                 "NULL AS inittypacl, NULL AS initrtypacl, "
-                                                 "(%s typowner) AS rolname, "
-                                                 "typinput::oid AS typinput, "
-                                                 "typoutput::oid AS typoutput, typelem, typrelid, "
-                                                 "CASE WHEN typrelid = 0 THEN ' '::\"char\" "
-                                                 "ELSE (SELECT relkind FROM pg_class WHERE oid = typrelid) END AS typrelkind, "
-                                                 "typtype, typisdefined, "
-                                                 "typname[0] = '_' AND typelem != 0 AS isarray "
-                                                 "FROM pg_type",
-                                                 username_subquery);
-       }
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -4013,8 +3838,7 @@ getTypes(Archive *fout, int *numTypes)
                tyinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_typname));
                tyinfo[i].dobj.namespace =
                        findNamespace(fout,
-                                                 atooid(PQgetvalue(res, i, i_typnamespace)),
-                                                 tyinfo[i].dobj.catId.oid);
+                                                 atooid(PQgetvalue(res, i, i_typnamespace)));
                tyinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
                tyinfo[i].typacl = pg_strdup(PQgetvalue(res, i, i_typacl));
                tyinfo[i].rtypacl = pg_strdup(PQgetvalue(res, i, i_rtypacl));
@@ -4083,48 +3907,6 @@ getTypes(Archive *fout, int *numTypes)
                         * this is taken care of while sorting dependencies.
                         */
                        stinfo->dobj.dump = DUMP_COMPONENT_NONE;
-
-                       /*
-                        * However, if dumping from pre-7.3, there will be no dependency
-                        * info so we have to fake it here.  We only need to worry about
-                        * typinput and typoutput since the other functions only exist
-                        * post-7.3.
-                        */
-                       if (fout->remoteVersion < 70300)
-                       {
-                               Oid                     typinput;
-                               Oid                     typoutput;
-                               FuncInfo   *funcInfo;
-
-                               typinput = atooid(PQgetvalue(res, i, i_typinput));
-                               typoutput = atooid(PQgetvalue(res, i, i_typoutput));
-
-                               funcInfo = findFuncByOid(typinput);
-                               if (funcInfo && funcInfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
-                               {
-                                       /* base type depends on function */
-                                       addObjectDependency(&tyinfo[i].dobj,
-                                                                               funcInfo->dobj.dumpId);
-                                       /* function depends on shell type */
-                                       addObjectDependency(&funcInfo->dobj,
-                                                                               stinfo->dobj.dumpId);
-                                       /* mark shell type as to be dumped */
-                                       stinfo->dobj.dump = DUMP_COMPONENT_ALL;
-                               }
-
-                               funcInfo = findFuncByOid(typoutput);
-                               if (funcInfo && funcInfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
-                               {
-                                       /* base type depends on function */
-                                       addObjectDependency(&tyinfo[i].dobj,
-                                                                               funcInfo->dobj.dumpId);
-                                       /* function depends on shell type */
-                                       addObjectDependency(&funcInfo->dobj,
-                                                                               stinfo->dobj.dumpId);
-                                       /* mark shell type as to be dumped */
-                                       stinfo->dobj.dump = DUMP_COMPONENT_ALL;
-                               }
-                       }
                }
 
                if (strlen(tyinfo[i].rolname) == 0)
@@ -4172,38 +3954,13 @@ getOperators(Archive *fout, int *numOprs)
        /* Make sure we are in proper schema */
        selectSourceSchema(fout, "pg_catalog");
 
-       if (fout->remoteVersion >= 70300)
-       {
-               appendPQExpBuffer(query, "SELECT tableoid, oid, oprname, "
-                                                 "oprnamespace, "
-                                                 "(%s oprowner) AS rolname, "
-                                                 "oprkind, "
-                                                 "oprcode::oid AS oprcode "
-                                                 "FROM pg_operator",
-                                                 username_subquery);
-       }
-       else if (fout->remoteVersion >= 70100)
-       {
-               appendPQExpBuffer(query, "SELECT tableoid, oid, oprname, "
-                                                 "0::oid AS oprnamespace, "
-                                                 "(%s oprowner) AS rolname, "
-                                                 "oprkind, "
-                                                 "oprcode::oid AS oprcode "
-                                                 "FROM pg_operator",
-                                                 username_subquery);
-       }
-       else
-       {
-               appendPQExpBuffer(query, "SELECT "
-                                                 "(SELECT oid FROM pg_class WHERE relname = 'pg_operator') AS tableoid, "
-                                                 "oid, oprname, "
-                                                 "0::oid AS oprnamespace, "
-                                                 "(%s oprowner) AS rolname, "
-                                                 "oprkind, "
-                                                 "oprcode::oid AS oprcode "
-                                                 "FROM pg_operator",
-                                                 username_subquery);
-       }
+       appendPQExpBuffer(query, "SELECT tableoid, oid, oprname, "
+                                         "oprnamespace, "
+                                         "(%s oprowner) AS rolname, "
+                                         "oprkind, "
+                                         "oprcode::oid AS oprcode "
+                                         "FROM pg_operator",
+                                         username_subquery);
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -4229,8 +3986,7 @@ getOperators(Archive *fout, int *numOprs)
                oprinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_oprname));
                oprinfo[i].dobj.namespace =
                        findNamespace(fout,
-                                                 atooid(PQgetvalue(res, i, i_oprnamespace)),
-                                                 oprinfo[i].dobj.catId.oid);
+                                                 atooid(PQgetvalue(res, i, i_oprnamespace)));
                oprinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
                oprinfo[i].oprkind = (PQgetvalue(res, i, i_oprkind))[0];
                oprinfo[i].oprcode = atooid(PQgetvalue(res, i, i_oprcode));
@@ -4319,8 +4075,7 @@ getCollations(Archive *fout, int *numCollations)
                collinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_collname));
                collinfo[i].dobj.namespace =
                        findNamespace(fout,
-                                                 atooid(PQgetvalue(res, i, i_collnamespace)),
-                                                 collinfo[i].dobj.catId.oid);
+                                                 atooid(PQgetvalue(res, i, i_collnamespace)));
                collinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
 
                /* Decide whether we want to dump it */
@@ -4358,13 +4113,6 @@ getConversions(Archive *fout, int *numConversions)
        int                     i_connamespace;
        int                     i_rolname;
 
-       /* Conversions didn't exist pre-7.3 */
-       if (fout->remoteVersion < 70300)
-       {
-               *numConversions = 0;
-               return NULL;
-       }
-
        query = createPQExpBuffer();
 
        /*
@@ -4403,8 +4151,7 @@ getConversions(Archive *fout, int *numConversions)
                convinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_conname));
                convinfo[i].dobj.namespace =
                        findNamespace(fout,
-                                                 atooid(PQgetvalue(res, i, i_connamespace)),
-                                                 convinfo[i].dobj.catId.oid);
+                                                 atooid(PQgetvalue(res, i, i_connamespace)));
                convinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
 
                /* Decide whether we want to dump it */
@@ -4527,30 +4274,11 @@ getOpclasses(Archive *fout, int *numOpclasses)
        /* Make sure we are in proper schema */
        selectSourceSchema(fout, "pg_catalog");
 
-       if (fout->remoteVersion >= 70300)
-       {
-               appendPQExpBuffer(query, "SELECT tableoid, oid, opcname, "
-                                                 "opcnamespace, "
-                                                 "(%s opcowner) AS rolname "
-                                                 "FROM pg_opclass",
-                                                 username_subquery);
-       }
-       else if (fout->remoteVersion >= 70100)
-       {
-               appendPQExpBufferStr(query, "SELECT tableoid, oid, opcname, "
-                                                        "0::oid AS opcnamespace, "
-                                                        "''::name AS rolname "
-                                                        "FROM pg_opclass");
-       }
-       else
-       {
-               appendPQExpBufferStr(query, "SELECT "
-                                                        "(SELECT oid FROM pg_class WHERE relname = 'pg_opclass') AS tableoid, "
-                                                        "oid, opcname, "
-                                                        "0::oid AS opcnamespace, "
-                                                        "''::name AS rolname "
-                                                        "FROM pg_opclass");
-       }
+       appendPQExpBuffer(query, "SELECT tableoid, oid, opcname, "
+                                         "opcnamespace, "
+                                         "(%s opcowner) AS rolname "
+                                         "FROM pg_opclass",
+                                         username_subquery);
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -4574,8 +4302,7 @@ getOpclasses(Archive *fout, int *numOpclasses)
                opcinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_opcname));
                opcinfo[i].dobj.namespace =
                        findNamespace(fout,
-                                                 atooid(PQgetvalue(res, i, i_opcnamespace)),
-                                                 opcinfo[i].dobj.catId.oid);
+                                                 atooid(PQgetvalue(res, i, i_opcnamespace)));
                opcinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
 
                /* Decide whether we want to dump it */
@@ -4584,12 +4311,9 @@ getOpclasses(Archive *fout, int *numOpclasses)
                /* Op Classes do not currently have ACLs. */
                opcinfo[i].dobj.dump &= ~DUMP_COMPONENT_ACL;
 
-               if (fout->remoteVersion >= 70300)
-               {
-                       if (strlen(opcinfo[i].rolname) == 0)
-                               write_msg(NULL, "WARNING: owner of operator class \"%s\" appears to be invalid\n",
-                                                 opcinfo[i].dobj.name);
-               }
+               if (strlen(opcinfo[i].rolname) == 0)
+                       write_msg(NULL, "WARNING: owner of operator class \"%s\" appears to be invalid\n",
+                                         opcinfo[i].dobj.name);
        }
 
        PQclear(res);
@@ -4665,8 +4389,7 @@ getOpfamilies(Archive *fout, int *numOpfamilies)
                opfinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_opfname));
                opfinfo[i].dobj.namespace =
                        findNamespace(fout,
-                                                 atooid(PQgetvalue(res, i, i_opfnamespace)),
-                                                 opfinfo[i].dobj.catId.oid);
+                                                 atooid(PQgetvalue(res, i, i_opfnamespace)));
                opfinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
 
                /* Decide whether we want to dump it */
@@ -4675,12 +4398,9 @@ getOpfamilies(Archive *fout, int *numOpfamilies)
                /* Extensions do not currently have ACLs. */
                opfinfo[i].dobj.dump &= ~DUMP_COMPONENT_ACL;
 
-               if (fout->remoteVersion >= 70300)
-               {
-                       if (strlen(opfinfo[i].rolname) == 0)
-                               write_msg(NULL, "WARNING: owner of operator family \"%s\" appears to be invalid\n",
-                                                 opfinfo[i].dobj.name);
-               }
+               if (strlen(opfinfo[i].rolname) == 0)
+                       write_msg(NULL, "WARNING: owner of operator family \"%s\" appears to be invalid\n",
+                                         opfinfo[i].dobj.name);
        }
 
        PQclear(res);
@@ -4798,7 +4518,7 @@ getAggregates(Archive *fout, int *numAggs)
                                                                 "deptype = 'e')");
                appendPQExpBufferChar(query, ')');
        }
-       else if (fout->remoteVersion >= 70300)
+       else
        {
                appendPQExpBuffer(query, "SELECT tableoid, oid, proname AS aggname, "
                                                  "pronamespace AS aggnamespace, "
@@ -4814,38 +4534,6 @@ getAggregates(Archive *fout, int *numAggs)
                           "(SELECT oid FROM pg_namespace WHERE nspname = 'pg_catalog')",
                                                  username_subquery);
        }
-       else if (fout->remoteVersion >= 70100)
-       {
-               appendPQExpBuffer(query, "SELECT tableoid, oid, aggname, "
-                                                 "0::oid AS aggnamespace, "
-                                 "CASE WHEN aggbasetype = 0 THEN 0 ELSE 1 END AS pronargs, "
-                                                 "aggbasetype AS proargtypes, "
-                                                 "(%s aggowner) AS rolname, "
-                                                 "NULL AS aggacl, "
-                                                 "NULL AS raggacl, "
-                                                 "NULL AS initaggacl, NULL AS initraggacl "
-                                                 "FROM pg_aggregate "
-                                                 "where oid > '%u'::oid",
-                                                 username_subquery,
-                                                 g_last_builtin_oid);
-       }
-       else
-       {
-               appendPQExpBuffer(query, "SELECT "
-                                                 "(SELECT oid FROM pg_class WHERE relname = 'pg_aggregate') AS tableoid, "
-                                                 "oid, aggname, "
-                                                 "0::oid AS aggnamespace, "
-                                 "CASE WHEN aggbasetype = 0 THEN 0 ELSE 1 END AS pronargs, "
-                                                 "aggbasetype AS proargtypes, "
-                                                 "(%s aggowner) AS rolname, "
-                                                 "NULL AS aggacl, "
-                                                 "NULL AS raggacl, "
-                                                 "NULL AS initaggacl, NULL AS initraggacl "
-                                                 "FROM pg_aggregate "
-                                                 "where oid > '%u'::oid",
-                                                 username_subquery,
-                                                 g_last_builtin_oid);
-       }
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -4875,8 +4563,7 @@ getAggregates(Archive *fout, int *numAggs)
                agginfo[i].aggfn.dobj.name = pg_strdup(PQgetvalue(res, i, i_aggname));
                agginfo[i].aggfn.dobj.namespace =
                        findNamespace(fout,
-                                                 atooid(PQgetvalue(res, i, i_aggnamespace)),
-                                                 agginfo[i].aggfn.dobj.catId.oid);
+                                                 atooid(PQgetvalue(res, i, i_aggnamespace)));
                agginfo[i].aggfn.rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
                if (strlen(agginfo[i].aggfn.rolname) == 0)
                        write_msg(NULL, "WARNING: owner of aggregate function \"%s\" appears to be invalid\n",
@@ -4893,13 +4580,9 @@ getAggregates(Archive *fout, int *numAggs)
                else
                {
                        agginfo[i].aggfn.argtypes = (Oid *) pg_malloc(agginfo[i].aggfn.nargs * sizeof(Oid));
-                       if (fout->remoteVersion >= 70300)
-                               parseOidArray(PQgetvalue(res, i, i_proargtypes),
-                                                         agginfo[i].aggfn.argtypes,
-                                                         agginfo[i].aggfn.nargs);
-                       else
-                               /* it's just aggbasetype */
-                               agginfo[i].aggfn.argtypes[0] = atooid(PQgetvalue(res, i, i_proargtypes));
+                       parseOidArray(PQgetvalue(res, i, i_proargtypes),
+                                                 agginfo[i].aggfn.argtypes,
+                                                 agginfo[i].aggfn.nargs);
                }
 
                /* Decide whether we want to dump it */
@@ -5025,7 +4708,7 @@ getFuncs(Archive *fout, int *numFuncs)
                destroyPQExpBuffer(initacl_subquery);
                destroyPQExpBuffer(initracl_subquery);
        }
-       else if (fout->remoteVersion >= 70300)
+       else
        {
                appendPQExpBuffer(query,
                                                  "SELECT tableoid, oid, proname, prolang, "
@@ -5056,39 +4739,6 @@ getFuncs(Archive *fout, int *numFuncs)
                                                                 "deptype = 'e')");
                appendPQExpBufferChar(query, ')');
        }
-       else if (fout->remoteVersion >= 70100)
-       {
-               appendPQExpBuffer(query,
-                                                 "SELECT tableoid, oid, proname, prolang, "
-                                                 "pronargs, proargtypes, prorettype, "
-                                                 "NULL AS proacl, "
-                                                 "NULL AS rproacl, "
-                                                 "NULL as initproacl, NULL AS initrproacl, "
-                                                 "0::oid AS pronamespace, "
-                                                 "(%s proowner) AS rolname "
-                                                 "FROM pg_proc "
-                                                 "WHERE pg_proc.oid > '%u'::oid",
-                                                 username_subquery,
-                                                 g_last_builtin_oid);
-       }
-       else
-       {
-               appendPQExpBuffer(query,
-                                                 "SELECT "
-                                                 "(SELECT oid FROM pg_class "
-                                                 " WHERE relname = 'pg_proc') AS tableoid, "
-                                                 "oid, proname, prolang, "
-                                                 "pronargs, proargtypes, prorettype, "
-                                                 "NULL AS proacl, "
-                                                 "NULL AS rproacl, "
-                                                 "NULL as initproacl, NULL AS initrproacl, "
-                                                 "0::oid AS pronamespace, "
-                                                 "(%s proowner) AS rolname "
-                                                 "FROM pg_proc "
-                                                 "where pg_proc.oid > '%u'::oid",
-                                                 username_subquery,
-                                                 g_last_builtin_oid);
-       }
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -5121,8 +4771,7 @@ getFuncs(Archive *fout, int *numFuncs)
                finfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_proname));
                finfo[i].dobj.namespace =
                        findNamespace(fout,
-                                                 atooid(PQgetvalue(res, i, i_pronamespace)),
-                                                 finfo[i].dobj.catId.oid);
+                                                 atooid(PQgetvalue(res, i, i_pronamespace)));
                finfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
                finfo[i].lang = atooid(PQgetvalue(res, i, i_prolang));
                finfo[i].prorettype = atooid(PQgetvalue(res, i, i_prorettype));
@@ -5645,7 +5294,7 @@ getTables(Archive *fout, int *numTables)
                                                  RELKIND_RELATION, RELKIND_SEQUENCE,
                                                  RELKIND_VIEW, RELKIND_COMPOSITE_TYPE);
        }
-       else if (fout->remoteVersion >= 80000)
+       else
        {
                /*
                 * Left join to pick up dependency info linking sequences to their
@@ -5686,153 +5335,6 @@ getTables(Archive *fout, int *numTables)
                                                  RELKIND_RELATION, RELKIND_SEQUENCE,
                                                  RELKIND_VIEW, RELKIND_COMPOSITE_TYPE);
        }
-       else if (fout->remoteVersion >= 70300)
-       {
-               /*
-                * Left join to pick up dependency info linking sequences to their
-                * owning column, if any
-                */
-               appendPQExpBuffer(query,
-                                                 "SELECT c.tableoid, c.oid, relname, "
-                                                 "relacl, NULL as rrelacl, "
-                                                 "NULL AS initrelacl, NULL AS initrrelacl, "
-                                                 "relkind, relnamespace, "
-                                                 "(%s relowner) AS rolname, "
-                                                 "relchecks, (reltriggers <> 0) AS relhastriggers, "
-                                                 "relhasindex, relhasrules, relhasoids, "
-                                                 "'f'::bool AS relrowsecurity, "
-                                                 "'f'::bool AS relforcerowsecurity, "
-                                                 "0 AS relfrozenxid, 0 AS relminmxid,"
-                                                 "0 AS toid, "
-                                                 "0 AS tfrozenxid, 0 AS tminmxid,"
-                                                 "'p' AS relpersistence, 't' as relispopulated, "
-                                                 "'d' AS relreplident, relpages, "
-                                                 "NULL AS reloftype, "
-                                                 "d.refobjid AS owning_tab, "
-                                                 "d.refobjsubid AS owning_col, "
-                                                 "NULL AS reltablespace, "
-                                                 "NULL AS reloptions, "
-                                                 "NULL AS toast_reloptions, "
-                                                 "NULL AS changed_acl "
-                                                 "FROM pg_class c "
-                                                 "LEFT JOIN pg_depend d ON "
-                                                 "(c.relkind = '%c' AND "
-                                                 "d.classid = c.tableoid AND d.objid = c.oid AND "
-                                                 "d.objsubid = 0 AND "
-                                                 "d.refclassid = c.tableoid AND d.deptype = 'i') "
-                                                 "WHERE relkind IN ('%c', '%c', '%c', '%c') "
-                                                 "ORDER BY c.oid",
-                                                 username_subquery,
-                                                 RELKIND_SEQUENCE,
-                                                 RELKIND_RELATION, RELKIND_SEQUENCE,
-                                                 RELKIND_VIEW, RELKIND_COMPOSITE_TYPE);
-       }
-       else if (fout->remoteVersion >= 70200)
-       {
-               appendPQExpBuffer(query,
-                                                 "SELECT tableoid, oid, relname, relacl, "
-                                                 "NULL as rrelacl, "
-                                                 "NULL AS initrelacl, NULL AS initrrelacl, "
-                                                 "relkind, "
-                                                 "0::oid AS relnamespace, "
-                                                 "(%s relowner) AS rolname, "
-                                                 "relchecks, (reltriggers <> 0) AS relhastriggers, "
-                                                 "relhasindex, relhasrules, relhasoids, "
-                                                 "'f'::bool AS relrowsecurity, "
-                                                 "'f'::bool AS relforcerowsecurity, "
-                                                 "0 AS relfrozenxid, 0 AS relminmxid,"
-                                                 "0 AS toid, "
-                                                 "0 AS tfrozenxid, 0 AS tminmxid,"
-                                                 "'p' AS relpersistence, 't' as relispopulated, "
-                                                 "'d' AS relreplident, relpages, "
-                                                 "NULL AS reloftype, "
-                                                 "NULL::oid AS owning_tab, "
-                                                 "NULL::int4 AS owning_col, "
-                                                 "NULL AS reltablespace, "
-                                                 "NULL AS reloptions, "
-                                                 "NULL AS toast_reloptions, "
-                                                 "NULL AS changed_acl "
-                                                 "FROM pg_class "
-                                                 "WHERE relkind IN ('%c', '%c', '%c') "
-                                                 "ORDER BY oid",
-                                                 username_subquery,
-                                                 RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW);
-       }
-       else if (fout->remoteVersion >= 70100)
-       {
-               /* all tables have oids in 7.1 */
-               appendPQExpBuffer(query,
-                                                 "SELECT tableoid, oid, relname, relacl, "
-                                                 "NULL as rrelacl, "
-                                                 "NULL AS initrelacl, NULL AS initrrelacl, "
-                                                 "relkind, "
-                                                 "0::oid AS relnamespace, "
-                                                 "(%s relowner) AS rolname, "
-                                                 "relchecks, (reltriggers <> 0) AS relhastriggers, "
-                                                 "relhasindex, relhasrules, "
-                                                 "'t'::bool AS relhasoids, "
-                                                 "'f'::bool AS relrowsecurity, "
-                                                 "'f'::bool AS relforcerowsecurity, "
-                                                 "0 AS relfrozenxid, 0 AS relminmxid,"
-                                                 "0 AS toid, "
-                                                 "0 AS tfrozenxid, 0 AS tminmxid,"
-                                                 "'p' AS relpersistence, 't' as relispopulated, "
-                                                 "'d' AS relreplident, relpages, "
-                                                 "NULL AS reloftype, "
-                                                 "NULL::oid AS owning_tab, "
-                                                 "NULL::int4 AS owning_col, "
-                                                 "NULL AS reltablespace, "
-                                                 "NULL AS reloptions, "
-                                                 "NULL AS toast_reloptions, "
-                                                 "NULL AS changed_acl "
-                                                 "FROM pg_class "
-                                                 "WHERE relkind IN ('%c', '%c', '%c') "
-                                                 "ORDER BY oid",
-                                                 username_subquery,
-                                                 RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW);
-       }
-       else
-       {
-               /*
-                * Before 7.1, view relkind was not set to 'v', so we must check if we
-                * have a view by looking for a rule in pg_rewrite.
-                */
-               appendPQExpBuffer(query,
-                                                 "SELECT "
-               "(SELECT oid FROM pg_class WHERE relname = 'pg_class') AS tableoid, "
-                                                 "oid, relname, relacl, NULL as rrelacl, "
-                                                 "NULL AS initrelacl, NULL AS initrrelacl, "
-                                                 "CASE WHEN relhasrules and relkind = 'r' "
-                                         "  and EXISTS(SELECT rulename FROM pg_rewrite r WHERE "
-                                         "             r.ev_class = c.oid AND r.ev_type = '1') "
-                                                 "THEN '%c'::\"char\" "
-                                                 "ELSE relkind END AS relkind,"
-                                                 "0::oid AS relnamespace, "
-                                                 "(%s relowner) AS rolname, "
-                                                 "relchecks, (reltriggers <> 0) AS relhastriggers, "
-                                                 "relhasindex, relhasrules, "
-                                                 "'t'::bool AS relhasoids, "
-                                                 "'f'::bool AS relrowsecurity, "
-                                                 "'f'::bool AS relforcerowsecurity, "
-                                                 "0 AS relfrozenxid, 0 AS relminmxid,"
-                                                 "0 AS toid, "
-                                                 "0 AS tfrozenxid, 0 AS tminmxid,"
-                                                 "'p' AS relpersistence, 't' as relispopulated, "
-                                                 "'d' AS relreplident, 0 AS relpages, "
-                                                 "NULL AS reloftype, "
-                                                 "NULL::oid AS owning_tab, "
-                                                 "NULL::int4 AS owning_col, "
-                                                 "NULL AS reltablespace, "
-                                                 "NULL AS reloptions, "
-                                                 "NULL AS toast_reloptions, "
-                                                 "NULL AS changed_acl "
-                                                 "FROM pg_class c "
-                                                 "WHERE relkind IN ('%c', '%c') "
-                                                 "ORDER BY oid",
-                                                 RELKIND_VIEW,
-                                                 username_subquery,
-                                                 RELKIND_RELATION, RELKIND_SEQUENCE);
-       }
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -5886,7 +5388,7 @@ getTables(Archive *fout, int *numTables)
        i_reloftype = PQfnumber(res, "reloftype");
        i_changed_acl = PQfnumber(res, "changed_acl");
 
-       if (dopt->lockWaitTimeout && fout->remoteVersion >= 70300)
+       if (dopt->lockWaitTimeout)
        {
                /*
                 * Arrange to fail instead of waiting forever for a table lock.
@@ -5910,8 +5412,7 @@ getTables(Archive *fout, int *numTables)
                tblinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_relname));
                tblinfo[i].dobj.namespace =
                        findNamespace(fout,
-                                                 atooid(PQgetvalue(res, i, i_relnamespace)),
-                                                 tblinfo[i].dobj.catId.oid);
+                                                 atooid(PQgetvalue(res, i, i_relnamespace)));
                tblinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
                tblinfo[i].relacl = pg_strdup(PQgetvalue(res, i, i_relacl));
                tblinfo[i].rrelacl = pg_strdup(PQgetvalue(res, i, i_rrelacl));
@@ -6017,7 +5518,7 @@ getTables(Archive *fout, int *numTables)
                                          tblinfo[i].dobj.name);
        }
 
-       if (dopt->lockWaitTimeout && fout->remoteVersion >= 70300)
+       if (dopt->lockWaitTimeout)
        {
                ExecuteSqlStatement(fout, "SET statement_timeout = 0");
        }
@@ -6290,7 +5791,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
                                                          "ORDER BY indexname",
                                                          tbinfo->dobj.catId.oid);
                }
-               else if (fout->remoteVersion >= 80000)
+               else
                {
                        appendPQExpBuffer(query,
                                                          "SELECT t.tableoid, t.oid, "
@@ -6319,87 +5820,6 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
                                                          "ORDER BY indexname",
                                                          tbinfo->dobj.catId.oid);
                }
-               else if (fout->remoteVersion >= 70300)
-               {
-                       appendPQExpBuffer(query,
-                                                         "SELECT t.tableoid, t.oid, "
-                                                         "t.relname AS indexname, "
-                                        "pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, "
-                                                         "t.relnatts AS indnkeys, "
-                                                         "i.indkey, i.indisclustered, "
-                                                         "false AS indisreplident, t.relpages, "
-                                                         "c.contype, c.conname, "
-                                                         "c.condeferrable, c.condeferred, "
-                                                         "c.tableoid AS contableoid, "
-                                                         "c.oid AS conoid, "
-                                                         "null AS condef, "
-                                                         "NULL AS tablespace, "
-                                                         "null AS indreloptions "
-                                                         "FROM pg_catalog.pg_index i "
-                                         "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) "
-                                                         "LEFT JOIN pg_catalog.pg_depend d "
-                                                         "ON (d.classid = t.tableoid "
-                                                         "AND d.objid = t.oid "
-                                                         "AND d.deptype = 'i') "
-                                                         "LEFT JOIN pg_catalog.pg_constraint c "
-                                                         "ON (d.refclassid = c.tableoid "
-                                                         "AND d.refobjid = c.oid) "
-                                                         "WHERE i.indrelid = '%u'::pg_catalog.oid "
-                                                         "ORDER BY indexname",
-                                                         tbinfo->dobj.catId.oid);
-               }
-               else if (fout->remoteVersion >= 70100)
-               {
-                       appendPQExpBuffer(query,
-                                                         "SELECT t.tableoid, t.oid, "
-                                                         "t.relname AS indexname, "
-                                                         "pg_get_indexdef(i.indexrelid) AS indexdef, "
-                                                         "t.relnatts AS indnkeys, "
-                                                         "i.indkey, false AS indisclustered, "
-                                                         "false AS indisreplident, t.relpages, "
-                                                         "CASE WHEN i.indisprimary THEN 'p'::char "
-                                                         "ELSE '0'::char END AS contype, "
-                                                         "t.relname AS conname, "
-                                                         "false AS condeferrable, "
-                                                         "false AS condeferred, "
-                                                         "0::oid AS contableoid, "
-                                                         "t.oid AS conoid, "
-                                                         "null AS condef, "
-                                                         "NULL AS tablespace, "
-                                                         "null AS indreloptions "
-                                                         "FROM pg_index i, pg_class t "
-                                                         "WHERE t.oid = i.indexrelid "
-                                                         "AND i.indrelid = '%u'::oid "
-                                                         "ORDER BY indexname",
-                                                         tbinfo->dobj.catId.oid);
-               }
-               else
-               {
-                       appendPQExpBuffer(query,
-                                                         "SELECT "
-                                                         "(SELECT oid FROM pg_class WHERE relname = 'pg_class') AS tableoid, "
-                                                         "t.oid, "
-                                                         "t.relname AS indexname, "
-                                                         "pg_get_indexdef(i.indexrelid) AS indexdef, "
-                                                         "t.relnatts AS indnkeys, "
-                                                         "i.indkey, false AS indisclustered, "
-                                                         "false AS indisreplident, t.relpages, "
-                                                         "CASE WHEN i.indisprimary THEN 'p'::char "
-                                                         "ELSE '0'::char END AS contype, "
-                                                         "t.relname AS conname, "
-                                                         "false AS condeferrable, "
-                                                         "false AS condeferred, "
-                                                         "0::oid AS contableoid, "
-                                                         "t.oid AS conoid, "
-                                                         "null AS condef, "
-                                                         "NULL AS tablespace, "
-                                                         "null AS indreloptions "
-                                                         "FROM pg_index i, pg_class t "
-                                                         "WHERE t.oid = i.indexrelid "
-                                                         "AND i.indrelid = '%u'::oid "
-                                                         "ORDER BY indexname",
-                                                         tbinfo->dobj.catId.oid);
-               }
 
                res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -6442,19 +5862,9 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
                        indxinfo[j].indnkeys = atoi(PQgetvalue(res, j, i_indnkeys));
                        indxinfo[j].tablespace = pg_strdup(PQgetvalue(res, j, i_tablespace));
                        indxinfo[j].indreloptions = pg_strdup(PQgetvalue(res, j, i_indreloptions));
-
-                       /*
-                        * In pre-7.4 releases, indkeys may contain more entries than
-                        * indnkeys says (since indnkeys will be 1 for a functional
-                        * index).  We don't actually care about this case since we don't
-                        * examine indkeys except for indexes associated with PRIMARY and
-                        * UNIQUE constraints, which are never functional indexes. But we
-                        * have to allocate enough space to keep parseOidArray from
-                        * complaining.
-                        */
-                       indxinfo[j].indkeys = (Oid *) pg_malloc(INDEX_MAX_KEYS * sizeof(Oid));
+                       indxinfo[j].indkeys = (Oid *) pg_malloc(indxinfo[j].indnkeys * sizeof(Oid));
                        parseOidArray(PQgetvalue(res, j, i_indkey),
-                                                 indxinfo[j].indkeys, INDEX_MAX_KEYS);
+                                                 indxinfo[j].indkeys, indxinfo[j].indnkeys);
                        indxinfo[j].indisclustered = (PQgetvalue(res, j, i_indisclustered)[0] == 't');
                        indxinfo[j].indisreplident = (PQgetvalue(res, j, i_indisreplident)[0] == 't');
                        indxinfo[j].relpages = atoi(PQgetvalue(res, j, i_relpages));
@@ -6465,9 +5875,6 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
                                /*
                                 * If we found a constraint matching the index, create an
                                 * entry for it.
-                                *
-                                * In a pre-7.3 database, we take this path iff the index was
-                                * marked indisprimary.
                                 */
                                constrinfo[j].dobj.objType = DO_CONSTRAINT;
                                constrinfo[j].dobj.catId.tableoid = atooid(PQgetvalue(res, j, i_contableoid));
@@ -6490,10 +5897,6 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
                                constrinfo[j].separate = true;
 
                                indxinfo[j].indexconstraint = constrinfo[j].dobj.dumpId;
-
-                               /* If pre-7.3 DB, better make sure table comes first */
-                               addObjectDependency(&constrinfo[j].dobj,
-                                                                       tbinfo->dobj.dumpId);
                        }
                        else
                        {
@@ -6532,10 +5935,6 @@ getConstraints(Archive *fout, TableInfo tblinfo[], int numTables)
                                i_condef;
        int                     ntups;
 
-       /* pg_constraint was created in 7.3, so nothing to do if older */
-       if (fout->remoteVersion < 70300)
-               return;
-
        query = createPQExpBuffer();
 
        for (i = 0; i < numTables; i++)
@@ -6621,10 +6020,6 @@ getDomainConstraints(Archive *fout, TypeInfo *tyinfo)
                                i_consrc;
        int                     ntups;
 
-       /* pg_constraint was created in 7.3, so nothing to do if older */
-       if (fout->remoteVersion < 70300)
-               return;
-
        /*
         * select appropriate schema to ensure names in constraint are properly
         * qualified
@@ -6642,17 +6037,9 @@ getDomainConstraints(Archive *fout, TypeInfo *tyinfo)
                                                  "ORDER BY conname",
                                                  tyinfo->dobj.catId.oid);
 
-       else if (fout->remoteVersion >= 70400)
-               appendPQExpBuffer(query, "SELECT tableoid, oid, conname, "
-                                                 "pg_catalog.pg_get_constraintdef(oid) AS consrc, "
-                                                 "true as convalidated "
-                                                 "FROM pg_catalog.pg_constraint "
-                                                 "WHERE contypid = '%u'::pg_catalog.oid "
-                                                 "ORDER BY conname",
-                                                 tyinfo->dobj.catId.oid);
        else
                appendPQExpBuffer(query, "SELECT tableoid, oid, conname, "
-                                                 "'CHECK (' || consrc || ')' AS consrc, "
+                                                 "pg_catalog.pg_get_constraintdef(oid) AS consrc, "