]> git.openstreetmap.org Git - nominatim.git/commitdiff
avoid deletes for new places
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 9 Mar 2012 23:06:28 +0000 (00:06 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 9 Mar 2012 23:06:28 +0000 (00:06 +0100)
sql/functions.sql

index 1f7586facaadd808745d342a054e2fb1cc056941..ccdb543141e1dbe1f9ff30543d332434578a601d 100644 (file)
@@ -1232,11 +1232,13 @@ BEGIN
       RETURN NEW;
     END IF;
 
-    result := deleteSearchName(NEW.partition, NEW.place_id);
-    DELETE FROM place_addressline WHERE place_id = NEW.place_id;
-    DELETE FROM place_boundingbox where place_id = NEW.place_id;
-    result := deleteRoad(NEW.partition, NEW.place_id);
-    result := deleteLocationArea(NEW.partition, NEW.place_id);
+    IF OLD.indexed_status > 1 THEN
+      result := deleteSearchName(NEW.partition, NEW.place_id);
+      DELETE FROM place_addressline WHERE place_id = NEW.place_id;
+      DELETE FROM place_boundingbox where place_id = NEW.place_id;
+      result := deleteRoad(NEW.partition, NEW.place_id);
+      result := deleteLocationArea(NEW.partition, NEW.place_id);
+    END IF;
 
     -- reclaculate country and partition (should probably have a country_code and calculated_country_code as seperate fields)
     SELECT country_code from place where osm_type = NEW.osm_type and osm_id = NEW.osm_id and class = NEW.class and type = NEW.type INTO NEW.country_code;