Make standalone backends ignore pg_database.datallowconn, so that there
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 5 May 2005 19:54:13 +0000 (19:54 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 5 May 2005 19:54:13 +0000 (19:54 +0000)
is a way to recover from disabling connections to all databases at once.

src/backend/utils/init/postinit.c

index d41735ab0fb877a066ffa90128a8449de5a5033a..713e9e9b4f3028c2ca489bb8a4a50fb258d480fa 100644 (file)
@@ -165,9 +165,11 @@ ReverifyMyDatabase(const char *name)
 
        /*
         * Also check that the database is currently allowing connections.
+        * (We do not enforce this in standalone mode, however, so that there is
+        * a way to recover from "UPDATE pg_database SET datallowconn = false;")
         */
        dbform = (Form_pg_database) GETSTRUCT(tup);
-       if (!dbform->datallowconn)
+       if (IsUnderPostmaster && !dbform->datallowconn)
                ereport(FATAL,
                                (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
                 errmsg("database \"%s\" is not currently accepting connections",