1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-05 09:19:17 +03:00

Un-break pg_dump for pre-8.3 source servers.

Commit 07b39083c 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
This commit is contained in:
Tom Lane 2019-08-13 16:57:59 -04:00
parent 99493bcbe7
commit 2b608ba313

View File

@ -17317,7 +17317,13 @@ getDependencies(Archive *fout)
* entries will have dependencies on their parent opfamily, which we * entries will have dependencies on their parent opfamily, which we
* should drop since they'd likewise become useless self-dependencies. * should drop since they'd likewise become useless self-dependencies.
* (But be sure to keep deps on *other* opfamilies; see amopsortfamily.) * (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.
*/ */
if (fout->remoteVersion >= 80300)
{
appendPQExpBufferStr(query, "UNION ALL\n" appendPQExpBufferStr(query, "UNION ALL\n"
"SELECT 'pg_opfamily'::regclass AS classid, amopfamily AS objid, refclassid, refobjid, deptype " "SELECT 'pg_opfamily'::regclass AS classid, amopfamily AS objid, refclassid, refobjid, deptype "
"FROM pg_depend d, pg_amop o " "FROM pg_depend d, pg_amop o "
@ -17332,6 +17338,7 @@ getDependencies(Archive *fout)
"WHERE deptype NOT IN ('p', 'e', 'i') AND " "WHERE deptype NOT IN ('p', 'e', 'i') AND "
"classid = 'pg_amproc'::regclass AND objid = p.oid " "classid = 'pg_amproc'::regclass AND objid = p.oid "
"AND NOT (refclassid = 'pg_opfamily'::regclass AND amprocfamily = refobjid)\n"); "AND NOT (refclassid = 'pg_opfamily'::regclass AND amprocfamily = refobjid)\n");
}
/* Sort the output for efficiency below */ /* Sort the output for efficiency below */
appendPQExpBufferStr(query, "ORDER BY 1,2"); appendPQExpBufferStr(query, "ORDER BY 1,2");