Commit 64719a18 authored by Bruce Momjian's avatar Bruce Momjian

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.
parent 60e7f459
...@@ -304,15 +304,14 @@ set_frozenxids(migratorContext *ctx) ...@@ -304,15 +304,14 @@ set_frozenxids(migratorContext *ctx)
PQclear(executeQueryOrDie(ctx, conn, PQclear(executeQueryOrDie(ctx, conn,
"UPDATE pg_catalog.pg_database " "UPDATE pg_catalog.pg_database "
"SET datfrozenxid = '%u' " "SET datfrozenxid = '%u' "
/* cannot connect to 'template0', so ignore */ "WHERE datallowconn = true",
"WHERE datname != 'template0'",
ctx->old.controldata.chkpnt_nxtxid)); ctx->old.controldata.chkpnt_nxtxid));
/* get database names */ /* get database names */
dbres = executeQueryOrDie(ctx, conn, dbres = executeQueryOrDie(ctx, conn,
"SELECT datname " "SELECT datname "
"FROM pg_catalog.pg_database " "FROM pg_catalog.pg_database "
"WHERE datname != 'template0'"); "WHERE datallowconn = true");
/* free dbres below */ /* free dbres below */
PQfinish(conn); PQfinish(conn);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment