X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/6ee4b30ee90efbcc4fcb59fee90139a5d1785e92..e4963256e1769cf56187d12c0b26b8be61e69b75:/tests/steps/terrain.py diff --git a/tests/steps/terrain.py b/tests/steps/terrain.py index 39fc6625..0a4495e0 100644 --- a/tests/steps/terrain.py +++ b/tests/steps/terrain.py @@ -173,7 +173,9 @@ def db_template_setup(): psycopg2.extras.register_hstore(conn, globally=False, unicode=True) cur = conn.cursor() for table in ('gb_postcode', 'us_postcode'): - cur.execute('TRUNCATE TABLE %s' % (table,)) + cur.execute("select * from pg_tables where tablename = '%s'" % (table, )) + if cur.rowcount > 0: + cur.execute('TRUNCATE TABLE %s' % (table,)) conn.commit() conn.close() # execute osm2pgsql on an empty file to get the right tables