- pre_code = """BEGIN;
- DROP TABLE IF EXISTS "osmviews";
- """
- post_code = "COMMIT"
- execute_file(dsn, datafile, ignore_errors=ignore_errors,
- pre_code=pre_code, post_code=post_code)
+ with connect(dsn) as conn:
+ postgis_version = conn.postgis_version_tuple()
+ if postgis_version[0] < 3:
+ LOG.error('PostGIS version is too old for using OSM raster data.')
+ return 2
+
+ execute_file(dsn, datafile, ignore_errors=ignore_errors)