]> git.openstreetmap.org Git - nominatim.git/blobdiff - sql/functions.sql
make sure invalid geometries are always deleted from place
[nominatim.git] / sql / functions.sql
index 20e97c1c87ec167fa3ce41da9595480ff964c3dd..03ea4011ddeec55f7ba388b43e40e6a75dc67125 100644 (file)
@@ -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 onhe 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;