Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 31d4371

Browse files
committed
Un-break pg_dump for pre-8.3 source servers.
Commit 07b3908 inserted an unconditional reference to pg_opfamily, which of course fails on servers predating that catalog. Fortunately, the case it's trying to solve can't occur on such old servers (AFAIK). Hence, just skip the additional code when the source predates 8.3. Per bug #15955 from sly. Back-patch to all supported branches, like the previous patch. Discussion: https://postgr.es/m/15955-1daa2e676e903d87@postgresql.org
1 parent af0ba49 commit 31d4371

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

src/bin/pg_dump/pg_dump.c

+21-14
Original file line numberDiff line numberDiff line change
@@ -17932,21 +17932,28 @@ getDependencies(Archive *fout)
1793217932
* entries will have dependencies on their parent opfamily, which we
1793317933
* should drop since they'd likewise become useless self-dependencies.
1793417934
* (But be sure to keep deps on *other* opfamilies; see amopsortfamily.)
17935+
*
17936+
* Skip this for pre-8.3 source servers: pg_opfamily doesn't exist there,
17937+
* and the (known) cases where it would matter to have these dependencies
17938+
* can't arise anyway.
1793517939
*/
17936-
appendPQExpBufferStr(query, "UNION ALL\n"
17937-
"SELECT 'pg_opfamily'::regclass AS classid, amopfamily AS objid, refclassid, refobjid, deptype "
17938-
"FROM pg_depend d, pg_amop o "
17939-
"WHERE deptype NOT IN ('p', 'e', 'i') AND "
17940-
"classid = 'pg_amop'::regclass AND objid = o.oid "
17941-
"AND NOT (refclassid = 'pg_opfamily'::regclass AND amopfamily = refobjid)\n");
17942-
17943-
/* Likewise for pg_amproc entries */
17944-
appendPQExpBufferStr(query, "UNION ALL\n"
17945-
"SELECT 'pg_opfamily'::regclass AS classid, amprocfamily AS objid, refclassid, refobjid, deptype "
17946-
"FROM pg_depend d, pg_amproc p "
17947-
"WHERE deptype NOT IN ('p', 'e', 'i') AND "
17948-
"classid = 'pg_amproc'::regclass AND objid = p.oid "
17949-
"AND NOT (refclassid = 'pg_opfamily'::regclass AND amprocfamily = refobjid)\n");
17940+
if (fout->remoteVersion >= 80300)
17941+
{
17942+
appendPQExpBufferStr(query, "UNION ALL\n"
17943+
"SELECT 'pg_opfamily'::regclass AS classid, amopfamily AS objid, refclassid, refobjid, deptype "
17944+
"FROM pg_depend d, pg_amop o "
17945+
"WHERE deptype NOT IN ('p', 'e', 'i') AND "
17946+
"classid = 'pg_amop'::regclass AND objid = o.oid "
17947+
"AND NOT (refclassid = 'pg_opfamily'::regclass AND amopfamily = refobjid)\n");
17948+
17949+
/* Likewise for pg_amproc entries */
17950+
appendPQExpBufferStr(query, "UNION ALL\n"
17951+
"SELECT 'pg_opfamily'::regclass AS classid, amprocfamily AS objid, refclassid, refobjid, deptype "
17952+
"FROM pg_depend d, pg_amproc p "
17953+
"WHERE deptype NOT IN ('p', 'e', 'i') AND "
17954+
"classid = 'pg_amproc'::regclass AND objid = p.oid "
17955+
"AND NOT (refclassid = 'pg_opfamily'::regclass AND amprocfamily = refobjid)\n");
17956+
}
1795017957

1795117958
/* Sort the output for efficiency below */
1795217959
appendPQExpBufferStr(query, "ORDER BY 1,2");

0 commit comments

Comments
 (0)