Make standalone backends ignore pg_database.datallowconn, so that there
authorTom Lane <[email protected]>
Thu, 5 May 2005 19:53:49 +0000 (19:53 +0000)
committerTom Lane <[email protected]>
Thu, 5 May 2005 19:53:49 +0000 (19:53 +0000)
is a way to recover from disabling connections to all databases at once.

src/backend/utils/init/postinit.c

index 85bfc93c8bc6489fe727d5dad31e734fed7b2df8..5def938a9d6db1e8f0f3b3761eee044cd600bbf3 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.127 2003/09/25 06:58:05 petere Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.127.2.1 2005/05/05 19:53:49 tgl Exp $
  *
  *
  *-------------------------------------------------------------------------
@@ -119,9 +119,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",