From 78a62c939769604619e715dfb99060ca65e74879 Mon Sep 17 00:00:00 2001 From: admire Date: Tue, 9 Jan 2018 15:46:54 +0200 Subject: [PATCH] Fix issue with a user creating a database without PostGIS extension --- PyQt4Dialogs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PyQt4Dialogs.py b/PyQt4Dialogs.py index 21051e3..8910be2 100755 --- a/PyQt4Dialogs.py +++ b/PyQt4Dialogs.py @@ -237,6 +237,7 @@ def test_database_schema(self): """Test whether co-go schema is applied in the database.""" query = "SELECT EXISTS (SELECT 1 AS result FROM pg_tables " \ "WHERE schemaname = 'public' AND tablename = 'beacons')" + extension_query = '''CREATE EXTENSION IF NOT EXISTS postgis ; ''' settings_postgis = QSettings() settings_postgis.beginGroup('PostgreSQL/connections') @@ -292,6 +293,7 @@ def test_database_schema(self): if self.db_connection: cursor = self.db_connection.cursor() + cursor.execute(extension_query) cursor.execute(query) is_schema_valid = cursor.fetchall()[0][0] del cursor