Skip to content

Commit 7971a57

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 97930cf commit 7971a57

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
@@ -3978,14 +3978,13 @@ getTables(int *numTables)
39783978
* owning column, if any (note this dependency is AUTO as of 8.2)
39793979
*/
39803980
appendPQExpBuffer(query,
3981-
"SELECT c.tableoid, c.oid, relname, "
3982-
"relacl, relkind, relnamespace, "
3983-
"(%s relowner) AS rolname, "
3984-
"relchecks, (reltriggers <> 0) AS relhastriggers, "
3985-
"relhasindex, relhasrules, relhasoids, "
3986-
"relfrozenxid, "
3987-
"0 AS toid, "
3988-
"0 AS tfrozenxid, "
3981+
"SELECT c.tableoid, c.oid, c.relname, "
3982+
"c.relacl, c.relkind, c.relnamespace, "
3983+
"(%s c.relowner) AS rolname, "
3984+
"c.relchecks, (c.reltriggers <> 0) AS relhastriggers, "
3985+
"c.relhasindex, c.relhasrules, c.relhasoids, "
3986+
"c.relfrozenxid, tc.oid AS toid, "
3987+
"tc.relfrozenxid AS tfrozenxid, "
39893988
"'p' AS relpersistence, "
39903989
"NULL AS reloftype, "
39913990
"d.refobjid AS owning_tab, "
@@ -3999,7 +3998,8 @@ getTables(int *numTables)
39993998
"d.classid = c.tableoid AND d.objid = c.oid AND "
40003999
"d.objsubid = 0 AND "
40014000
"d.refclassid = c.tableoid AND d.deptype = 'a') "
4002-
"WHERE relkind in ('%c', '%c', '%c', '%c') "
4001+
"LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) "
4002+
"WHERE c.relkind in ('%c', '%c', '%c', '%c') "
40034003
"ORDER BY c.oid",
40044004
username_subquery,
40054005
RELKIND_SEQUENCE,

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