X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/8bf15fa691e286c27c05619ae102fb4db16eda0d..2cdbcac353805767df011edc494f8067f9409f63:/test/python/cursor.py?ds=sidebyside diff --git a/test/python/cursor.py b/test/python/cursor.py index 46069020..620cdd98 100644 --- a/test/python/cursor.py +++ b/test/python/cursor.py @@ -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. """