]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/cursor.py
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / test / python / cursor.py
index 46069020b1cc07ba05ac6ef3d6535e502bbc4e50..620cdd98511ddfdbd66923c489dafed6e58934ae 100644 (file)
@@ -37,6 +37,15 @@ class CursorForTesting(psycopg2.extras.DictCursor):
         return num == 1
 
 
+    def index_exists(self, table, index):
+        """ Check that an indexwith the given name exists on the given table.
+        """
+        num = self.scalar("""SELECT count(*) FROM pg_indexes
+                             WHERE tablename = %s and indexname = %s""",
+                          (table, index))
+        return num == 1
+
+
     def table_rows(self, table, where=None):
         """ Return the number of rows in the given table.
         """