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

Commit dbb8d47

Browse files
committed
Fix pg_upgrade to preserve toast relfrozenxids for old 8.3 servers.
This fixes a pg_upgrade bug that could lead to query errors when clog files are improperly removed. Backpatch to 8.4, 9.0, 9.1.
1 parent ca4f70c commit dbb8d47

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3960,14 +3960,13 @@ getTables(int *numTables)
39603960
* owning column, if any (note this dependency is AUTO as of 8.2)
39613961
*/
39623962
appendPQExpBuffer(query,
3963-
"SELECT c.tableoid, c.oid, relname, "
3964-
"relacl, relkind, relnamespace, "
3965-
"(%s relowner) AS rolname, "
3966-
"relchecks, (reltriggers <> 0) AS relhastriggers, "
3967-
"relhasindex, relhasrules, relhasoids, "
3968-
"relfrozenxid, "
3969-
"0 AS toid, "
3970-
"0 AS tfrozenxid, "
3963+
"SELECT c.tableoid, c.oid, c.relname, "
3964+
"c.relacl, c.relkind, c.relnamespace, "
3965+
"(%s c.relowner) AS rolname, "
3966+
"c.relchecks, (c.reltriggers <> 0) AS relhastriggers, "
3967+
"c.relhasindex, c.relhasrules, c.relhasoids, "
3968+
"c.relfrozenxid, tc.oid AS toid, "
3969+
"tc.relfrozenxid AS tfrozenxid, "
39713970
"'p' AS relpersistence, "
39723971
"NULL AS reloftype, "
39733972
"d.refobjid AS owning_tab, "
@@ -3981,7 +3980,8 @@ getTables(int *numTables)
39813980
"d.classid = c.tableoid AND d.objid = c.oid AND "
39823981
"d.objsubid = 0 AND "
39833982
"d.refclassid = c.tableoid AND d.deptype = 'a') "
3984-
"WHERE relkind in ('%c', '%c', '%c', '%c') "
3983+
"LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) "
3984+
"WHERE c.relkind in ('%c', '%c', '%c', '%c') "
39853985
"ORDER BY c.oid",
39863986
username_subquery,
39873987
RELKIND_SEQUENCE,

0 commit comments

Comments
 (0)