]> git.openstreetmap.org Git - nominatim.git/commitdiff
remove special casing of houses and postcodes in place import
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 8 Sep 2014 20:27:24 +0000 (22:27 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 8 Sep 2014 20:27:24 +0000 (22:27 +0200)
sql/functions.sql
tests/features/db/update/simple.feature

index a8c5058a2e2aaee726ceadf30513a9df5eae09c3..2c415620a40cf5dfa70cd6fc62bae646ba970e57 100644 (file)
@@ -2090,8 +2090,8 @@ BEGIN
   -- Handle a place changing type by removing the old data
   -- My generated 'place' types are causing havok because they overlap with real keys
   -- TODO: move them to their own special purpose key/class to avoid collisions
   -- Handle a place changing type by removing the old data
   -- My generated 'place' types are causing havok because they overlap with real keys
   -- TODO: move them to their own special purpose key/class to avoid collisions
-  IF existing.osm_type IS NULL AND (NEW.type not in ('postcode','house','houses')) THEN
-    DELETE FROM place where osm_type = NEW.osm_type and osm_id = NEW.osm_id and class = NEW.class and type not in ('postcode','house','houses');
+  IF existing.osm_type IS NULL THEN
+    DELETE FROM place where osm_type = NEW.osm_type and osm_id = NEW.osm_id and class = NEW.class;
   END IF;
 
   --DEBUG: RAISE WARNING 'Existing: %',existing.osm_id;
   END IF;
 
   --DEBUG: RAISE WARNING 'Existing: %',existing.osm_id;
index 4493bffba1f89b926320d74a055d54124b63766f..c7874ea0b96099fccf5c4817ab89067ceaf7c0bf 100644 (file)
@@ -53,3 +53,35 @@ Feature: Update of simple objects
         When marking for delete R1,W1
         Then table placex has no entry for W1
         Then table placex has no entry for R1
         When marking for delete R1,W1
         Then table placex has no entry for W1
         Then table placex has no entry for R1
+
+
+    Scenario: type mutation
+        Given the place nodes
+          | osm_id | class | type | geometry
+          | 3      | shop  | toys | 1 -1
+        When importing
+        Then table placex contains
+          | object | class | type
+          | N3     | shop  | toys
+        When updating place nodes
+          | osm_id | class | type    | geometry
+          | 3      | shop  | grocery | 1 -1
+        Then table placex contains
+          | object | class | type
+          | N3     | shop  | grocery
+
+
+    Scenario: remove postcode place when house number is added
+        Given the place nodes
+          | osm_id | class | type     | postcode | geometry
+          | 3      | place | postcode | 12345    | 1 -1
+        When importing
+        Then table placex contains
+          | object | class | type
+          | N3     | place | postcode
+        When updating place nodes
+          | osm_id | class | type  | postcode | housenumber | geometry
+          | 3      | place | house | 12345    | 13          | 1 -1
+        Then table placex contains
+          | object | class | type
+          | N3     | place | house