From: Sarah Hoffmann Date: Wed, 7 Jun 2017 18:44:46 +0000 (+0200) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Tag: deploy~383 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/09f95609cd4f44bbacd275569b043cc665584fa5?ds=inline;hp=-c Merge remote-tracking branch 'upstream/master' --- 09f95609cd4f44bbacd275569b043cc665584fa5 diff --combined sql/functions.sql index 2606cdca,a49ba02b..d3207843 --- a/sql/functions.sql +++ b/sql/functions.sql @@@ -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, @@@ -2161,6 -2167,20 +2167,20 @@@ 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)