From de45bafc5455c3ccf4c8fd082abef9ee8dfe9d3d Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Tue, 17 Sep 2013 21:26:07 +0200 Subject: [PATCH] force delete from place if there is no corresponding object in placex This might happen for nameless landuse/natural objects that are added to place during initial import but then dropped when being copied to placex. If they later receive a name, thus becoming valid, then place_insert should delete the orphan object in place and reinsert it. If they are large enough, the place_delete trigger prevents them from being removed. The additional update fools the delete trigger. --- sql/functions.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql/functions.sql b/sql/functions.sql index 6d2ae5f8..48720628 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -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; -- 2.39.5