X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/bd529c1f9d8ea547a0b41855147e4672f7d84b00..8ff0aabaf3e82e6bc99894e22d312ccc4b76529f:/sql/functions.sql?ds=sidebyside

diff --git a/sql/functions.sql b/sql/functions.sql
index 20e97c1c..03ea4011 100644
--- a/sql/functions.sql
+++ b/sql/functions.sql
@@ -1806,8 +1806,8 @@ BEGIN
 
   --DEBUG: RAISE WARNING 'delete: % % % %',OLD.osm_type,OLD.osm_id,OLD.class,OLD.type;
 
-  -- deleting large polygons can have a massive effect ont he system - require manual intervention to let them through
-  IF st_area(OLD.geometry) > 2 THEN
+  -- deleting large polygons can have a massive effect on the system - require manual intervention to let them through
+  IF st_area(OLD.geometry) > 2 and st_isvalid(OLD.geometry) THEN
     insert into import_polygon_delete values (OLD.osm_type,OLD.osm_id,OLD.class,OLD.type);
     RETURN NULL;
   END IF;
