]> git.openstreetmap.org Git - nominatim.git/blobdiff - sql/functions.sql
force delete from place if there is no corresponding object in placex
[nominatim.git] / sql / functions.sql
index 6d2ae5f8cfd6b99011a56369b5f73a17e6e8b852..48720628e63c38126e32ca5fda7c43b9bfc1b7be 100644 (file)
@@ -2097,6 +2097,9 @@ BEGIN
   IF existingplacex.osm_type IS NULL THEN
 
     IF existing.osm_type IS NOT NULL THEN
+      -- pathological case caused by the triggerless copy into place during initial import
+      -- force delete even for large areas, it will be reinserted later
+      UPDATE place set geometry = ST_SetSRID(ST_Point(0,0), 4326) where osm_type = NEW.osm_type and osm_id = NEW.osm_id and class = NEW.class and type = NEW.type;
       DELETE from place where osm_type = NEW.osm_type and osm_id = NEW.osm_id and class = NEW.class and type = NEW.type;
     END IF;