]> granicus.if.org Git - pgbouncer/commitdiff
Create auto databases as needed when doing PAUSE.
authorMichael Tharp <gxti@partiallystapled.com>
Fri, 18 Mar 2011 14:12:35 +0000 (10:12 -0400)
committerMichael Tharp <gxti@partiallystapled.com>
Fri, 18 Mar 2011 14:12:35 +0000 (10:12 -0400)
src/admin.c

index 6f19379f2c83e5839f760bccf371b68223d01c98..0125de7c46c6e3b705fb21bb2b659533260344ac 100644 (file)
@@ -891,8 +891,14 @@ static bool admin_cmd_pause(PgSocket *admin, const char *arg)
                PgDatabase *db;
                log_info("PAUSE '%s' command issued", arg);
                db = find_database(arg);
-               if (db == NULL)
-                       return admin_error(admin, "no such database: %s", arg);
+               if (db == NULL) {
+                       db = register_auto_database(arg);
+                       if (db == NULL) {
+                               return admin_error(admin, "no such database: %s", arg);
+                       } else {
+                               slog_info(admin, "registered new auto-database for PAUSE: %s", arg);
+                       }
+               }
                if (db == admin->pool->db)
                        return admin_error(admin, "cannot pause admin db: %s", arg);
                db->db_paused = 1;