diff --git a/django/contrib/gis/db/backends/postgis/creation.py b/django/contrib/gis/db/backends/postgis/creation.py index 4f64ecce29..51ac197b8e 100644 --- a/django/contrib/gis/db/backends/postgis/creation.py +++ b/django/contrib/gis/db/backends/postgis/creation.py @@ -89,7 +89,7 @@ class PostGISCreation(DatabaseCreation): self.connection.close() self.connection.settings_dict["NAME"] = test_database_name cursor = self.connection.cursor() - cursor.execute("CREATE EXTENSION postgis") + cursor.execute("CREATE EXTENSION IF NOT EXISTS postgis") cursor.connection.commit() return test_database_name