From b894bc2b771f8d87acb4b1e01aef713551941e28 Mon Sep 17 00:00:00 2001 From: "Michael J. Schultz" Date: Tue, 23 Dec 2014 14:16:29 -0600 Subject: [PATCH] Build the db connection on `"postgres"` instead of `"template1"` According to the postgresql docs[1], you should not have a connection with `"template1"` when copying multiple databases. [1]: http://www.postgresql.org/docs/9.1/static/manage-ag-templatedbs.html --- database/postgresql/postgresql_db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/postgresql/postgresql_db.py b/database/postgresql/postgresql_db.py index 941644d6fb1..4ce8e146ccd 100644 --- a/database/postgresql/postgresql_db.py +++ b/database/postgresql/postgresql_db.py @@ -275,7 +275,7 @@ def main(): kw["host"] = module.params["login_unix_socket"] try: - db_connection = psycopg2.connect(database="template1", **kw) + db_connection = psycopg2.connect(database="postgres", **kw) # Enable autocommit so we can create databases if psycopg2.__version__ >= '2.4.2': db_connection.autocommit = True