X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/ddcb95ca39c041ce9079d3c75367f5f8bc28b503..00379183adaca10dbbae1c3819e8652269d49ad7:/sql/functions.sql

diff --git a/sql/functions.sql b/sql/functions.sql
index e404da7c..a5d0f6a0 100644
--- a/sql/functions.sql
+++ b/sql/functions.sql
@@ -2035,6 +2035,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, '')
