From: Bruce Momjian Date: Tue, 18 May 2010 18:40:51 +0000 (+0000) Subject: Use a 'datallowconn' check for avoiding 'template0', rather than X-Git-Tag: REL9_0_BETA2~96 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=64719a18dbe36871635bbebd718a1267b9447bcd;p=postgresql Use a 'datallowconn' check for avoiding 'template0', rather than 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. --- diff --git a/contrib/pg_upgrade/pg_upgrade.c b/contrib/pg_upgrade/pg_upgrade.c index e35cd5a894..fc692fc96a 100644 --- a/contrib/pg_upgrade/pg_upgrade.c +++ b/contrib/pg_upgrade/pg_upgrade.c @@ -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);