Skip to content

Commit cfa3df3

Browse files
committed
Fix broken pg_dump for 9.0 and 9.1 caused by the MV patch.
Per report and suggestion from Bernd Helmle
1 parent cd340ca commit cfa3df3

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4141,7 +4141,7 @@ getTables(Archive *fout, int *numTables)
41414141
* we cannot correctly identify inherited columns, owned sequences, etc.
41424142
*/
41434143

4144-
if (fout->remoteVersion >= 90100)
4144+
if (fout->remoteVersion >= 90300)
41454145
{
41464146
/*
41474147
* Left join to pick up dependency info linking sequences to their
@@ -4177,6 +4177,42 @@ getTables(Archive *fout, int *numTables)
41774177
RELKIND_VIEW, RELKIND_COMPOSITE_TYPE,
41784178
RELKIND_MATVIEW, RELKIND_FOREIGN_TABLE);
41794179
}
4180+
else if (fout->remoteVersion >= 90100)
4181+
{
4182+
/*
4183+
* Left join to pick up dependency info linking sequences to their
4184+
* owning column, if any (note this dependency is AUTO as of 8.2)
4185+
*/
4186+
appendPQExpBuffer(query,
4187+
"SELECT c.tableoid, c.oid, c.relname, "
4188+
"c.relacl, c.relkind, c.relnamespace, "
4189+
"(%s c.relowner) AS rolname, "
4190+
"c.relchecks, c.relhastriggers, "
4191+
"c.relhasindex, c.relhasrules, c.relhasoids, "
4192+
"c.relfrozenxid, tc.oid AS toid, "
4193+
"tc.relfrozenxid AS tfrozenxid, "
4194+
"c.relpersistence, 't'::bool as isscannable, "
4195+
"CASE WHEN c.reloftype <> 0 THEN c.reloftype::pg_catalog.regtype ELSE NULL END AS reloftype, "
4196+
"d.refobjid AS owning_tab, "
4197+
"d.refobjsubid AS owning_col, "
4198+
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS reltablespace, "
4199+
"array_to_string(c.reloptions, ', ') AS reloptions, "
4200+
"array_to_string(array(SELECT 'toast.' || x FROM unnest(tc.reloptions) x), ', ') AS toast_reloptions "
4201+
"FROM pg_class c "
4202+
"LEFT JOIN pg_depend d ON "
4203+
"(c.relkind = '%c' AND "
4204+
"d.classid = c.tableoid AND d.objid = c.oid AND "
4205+
"d.objsubid = 0 AND "
4206+
"d.refclassid = c.tableoid AND d.deptype = 'a') "
4207+
"LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) "
4208+
"WHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c') "
4209+
"ORDER BY c.oid",
4210+
username_subquery,
4211+
RELKIND_SEQUENCE,
4212+
RELKIND_RELATION, RELKIND_SEQUENCE,
4213+
RELKIND_VIEW, RELKIND_COMPOSITE_TYPE,
4214+
RELKIND_MATVIEW, RELKIND_FOREIGN_TABLE);
4215+
}
41804216
else if (fout->remoteVersion >= 90000)
41814217
{
41824218
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy