]> granicus.if.org Git - postgresql/blobdiff - src/bin/pg_dump/pg_dump.c
Un-break pg_dump for pre-8.3 source servers.
[postgresql] / src / bin / pg_dump / pg_dump.c
index 0cc9eded242c2f94b33b4b7217003cb94c06194f..be25e94cb2007bdefe5ebf700ed6b3870002c891 100644 (file)
@@ -17932,21 +17932,28 @@ getDependencies(Archive *fout)
         * entries will have dependencies on their parent opfamily, which we
         * should drop since they'd likewise become useless self-dependencies.
         * (But be sure to keep deps on *other* opfamilies; see amopsortfamily.)
+        *
+        * Skip this for pre-8.3 source servers: pg_opfamily doesn't exist there,
+        * and the (known) cases where it would matter to have these dependencies
+        * can't arise anyway.
         */
-       appendPQExpBufferStr(query, "UNION ALL\n"
-                                                "SELECT 'pg_opfamily'::regclass AS classid, amopfamily AS objid, refclassid, refobjid, deptype "
-                                                "FROM pg_depend d, pg_amop o "
-                                                "WHERE deptype NOT IN ('p', 'e', 'i') AND "
-                                                "classid = 'pg_amop'::regclass AND objid = o.oid "
-                                                "AND NOT (refclassid = 'pg_opfamily'::regclass AND amopfamily = refobjid)\n");
-
-       /* Likewise for pg_amproc entries */
-       appendPQExpBufferStr(query, "UNION ALL\n"
-                                                "SELECT 'pg_opfamily'::regclass AS classid, amprocfamily AS objid, refclassid, refobjid, deptype "
-                                                "FROM pg_depend d, pg_amproc p "
-                                                "WHERE deptype NOT IN ('p', 'e', 'i') AND "
-                                                "classid = 'pg_amproc'::regclass AND objid = p.oid "
-                                                "AND NOT (refclassid = 'pg_opfamily'::regclass AND amprocfamily = refobjid)\n");
+       if (fout->remoteVersion >= 80300)
+       {
+               appendPQExpBufferStr(query, "UNION ALL\n"
+                                                        "SELECT 'pg_opfamily'::regclass AS classid, amopfamily AS objid, refclassid, refobjid, deptype "
+                                                        "FROM pg_depend d, pg_amop o "
+                                                        "WHERE deptype NOT IN ('p', 'e', 'i') AND "
+                                                        "classid = 'pg_amop'::regclass AND objid = o.oid "
+                                                        "AND NOT (refclassid = 'pg_opfamily'::regclass AND amopfamily = refobjid)\n");
+
+               /* Likewise for pg_amproc entries */
+               appendPQExpBufferStr(query, "UNION ALL\n"
+                                                        "SELECT 'pg_opfamily'::regclass AS classid, amprocfamily AS objid, refclassid, refobjid, deptype "
+                                                        "FROM pg_depend d, pg_amproc p "
+                                                        "WHERE deptype NOT IN ('p', 'e', 'i') AND "
+                                                        "classid = 'pg_amproc'::regclass AND objid = p.oid "
+                                                        "AND NOT (refclassid = 'pg_opfamily'::regclass AND amprocfamily = refobjid)\n");
+       }
 
        /* Sort the output for efficiency below */
        appendPQExpBufferStr(query, "ORDER BY 1,2");