X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/2f8a29ba39e4ca995334f2702985afa761bfffbd..3d1caa5a6ce8b5f4886f2941d25df6fc796de662:/sql/functions.sql?ds=sidebyside

diff --git a/sql/functions.sql b/sql/functions.sql
index 3c8f16e0..1efb1899 100644
--- a/sql/functions.sql
+++ b/sql/functions.sql
@@ -2055,6 +2055,12 @@ BEGIN
   END IF;
 
 
+  -- refuse to update multiplpoygons with too many objects, too much of a performance hit
+  IF ST_NumGeometries(NEW.geometry) > 2000 THEN
+    RAISE WARNING 'Dropping update of % % because of geometry complexity.', NEW.osm_type, NEW.osm_id;
+    RETURN NULL;
+  END IF;
+
   IF coalesce(existing.name::text, '') != coalesce(NEW.name::text, '')
      OR coalesce(existing.extratags::text, '') != coalesce(NEW.extratags::text, '')
      OR coalesce(existing.housenumber, '') != coalesce(NEW.housenumber, '')
