]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 7 Jun 2017 18:44:46 +0000 (20:44 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 7 Jun 2017 18:44:46 +0000 (20:44 +0200)
1  2 
sql/functions.sql

diff --combined sql/functions.sql
index 2606cdcabc2dcb45ffe189ed9fcff7f1b990fe28,a49ba02bc2cf4d48ba04f0c630943bcefcd834a6..d3207843906db0312640f2034a01bfba6fb3a9ed
@@@ -2144,6 -2144,12 +2144,12 @@@ BEGI
            NEW.name := hstore('ref', NEW.address->'postcode');
        END IF;
  
+       IF NEW.class in ('boundary')
+          AND ST_GeometryType(NEW.geometry) not in ('ST_Polygon','ST_MultiPolygon') THEN
+           DELETE FROM placex where place_id = existingplacex.place_id;
+           RETURN NULL;
+       END IF;
        update placex set 
          name = NEW.name,
          address = NEW.address,
            update location_property_osmline p set indexed_status = 2 from planet_osm_ways w where p.linegeo && NEW.geometry and p.osm_id = w.id and NEW.osm_id = any(w.nodes);
        END IF;
  
+       -- linked places should get potential new naming and addresses
+       IF existingplacex.linked_place_id is not NULL THEN
+         update placex x set
+           name = p.name,
+           extratags = p.extratags,
+           indexed_status = 2
+         from place p
+         where x.place_id = existingplacex.linked_place_id
+               and x.indexed_status = 0
+               and x.osm_type = p.osm_type
+               and x.osm_id = p.osm_id
+               and x.class = p.class;
+       END IF;
      END IF;
  
      -- Abort the add (we modified the existing place instead)
@@@ -2381,7 -2401,7 +2401,7 @@@ BEGI
        CASE WHEN class = 'place' and type = 'postcode' THEN hstore('name', postcode) ELSE name END as name,
        CASE WHEN extratags ? 'place' THEN 'place' ELSE class END as class,
        CASE WHEN extratags ? 'place' THEN extratags->'place' ELSE type END as type,
 -      admin_level, fromarea, isaddress,
 +      admin_level, fromarea, isaddress and linked_place_id is NULL as isaddress,
        CASE WHEN address_place_id = for_place_id AND rank_address = 0 THEN 100 WHEN rank_address = 11 THEN 5 ELSE rank_address END as rank_address,
        distance,country_code,postcode
        from place_addressline join placex on (address_place_id = placex.place_id)