]> granicus.if.org Git - postgresql/commitdiff
Use a 'datallowconn' check for avoiding 'template0', rather than
authorBruce Momjian <bruce@momjian.us>
Tue, 18 May 2010 18:40:51 +0000 (18:40 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 18 May 2010 18:40:51 +0000 (18:40 +0000)
hardcoding a 'template0' check, per suggestion from Alvaro.

This might fix a problem where someone has allowed 'template0'
connections, but it is a cleaner approach even if doesn't fix the
bug.

contrib/pg_upgrade/pg_upgrade.c

index e35cd5a8943d562277f574bb7d4b42e2f1952fea..fc692fc96a1eece54406508c053255dbbdfbcbc5 100644 (file)
@@ -304,15 +304,14 @@ set_frozenxids(migratorContext *ctx)
        PQclear(executeQueryOrDie(ctx, conn,
                                                          "UPDATE pg_catalog.pg_database "
                                                          "SET  datfrozenxid = '%u' "
-       /* cannot connect to 'template0', so ignore */
-                                                         "WHERE        datname != 'template0'",
+                                                         "WHERE datallowconn = true",
                                                          ctx->old.controldata.chkpnt_nxtxid));
 
        /* get database names */
        dbres = executeQueryOrDie(ctx, conn,
                                                          "SELECT       datname "
                                                          "FROM pg_catalog.pg_database "
-                                                         "WHERE        datname != 'template0'");
+                                                         "WHERE datallowconn = true");
 
        /* free dbres below */
        PQfinish(conn);