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

pg_upgrade: preserve freeze info for postgres/template1 dbs

pg_database.datfrozenxid and pg_database.datminmxid were not preserved
for the 'postgres' and 'template1' databases.  This could cause missing
clog file errors on access to user tables and indexes after upgrades in
these databases.

Backpatch through 9.0
This commit is contained in:
Bruce Momjian 2015-02-11 21:02:07 -05:00
parent 0168fb07da
commit d99cf27b7f

View File

@ -1356,17 +1356,17 @@ dumpCreateDB(PGconn *conn)
appendStringLiteralConn(buf, dbname, conn); appendStringLiteralConn(buf, dbname, conn);
appendPQExpBuffer(buf, ";\n"); appendPQExpBuffer(buf, ";\n");
} }
}
if (binary_upgrade) if (binary_upgrade)
{ {
appendPQExpBuffer(buf, "-- For binary upgrade, set datfrozenxid.\n"); appendPQExpBuffer(buf, "-- For binary upgrade, set datfrozenxid.\n");
appendPQExpBuffer(buf, "UPDATE pg_catalog.pg_database " appendPQExpBuffer(buf, "UPDATE pg_catalog.pg_database "
"SET datfrozenxid = '%u' " "SET datfrozenxid = '%u' "
"WHERE datname = ", "WHERE datname = ",
dbfrozenxid); dbfrozenxid);
appendStringLiteralConn(buf, dbname, conn); appendStringLiteralConn(buf, dbname, conn);
appendPQExpBuffer(buf, ";\n"); appendPQExpBuffer(buf, ";\n");
}
} }
if (!skip_acls && if (!skip_acls &&