Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
pg_upgrade: preserve freeze info for postgres/template1 dbs
authorBruce Momjian <bruce@momjian.us>
Thu, 12 Feb 2015 02:02:07 +0000 (21:02 -0500)
committerBruce Momjian <bruce@momjian.us>
Thu, 12 Feb 2015 02:02:07 +0000 (21:02 -0500)
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

src/bin/pg_dump/pg_dumpall.c

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