]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Sat, 18 Feb 2017 12:54:49 +0000 (13:54 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Sat, 18 Feb 2017 12:54:49 +0000 (13:54 +0100)
1  2 
sql/functions.sql

diff --combined sql/functions.sql
index b086786aa7a3544e2b1ff2f0f0ea73dffb8bdb58,f9a89b51f26f134d90aefbcdd402cb904de57bd6..4df13e67a7d841355acb2d42518f830d3dab7357
@@@ -1988,7 -1988,10 +1988,10 @@@ BEGI
  
      -- Patch in additional country names
      IF NEW.admin_level = 2 AND NEW.type = 'administrative' AND NEW.country_code is not null THEN
-       select coalesce(country_name.name || NEW.name,NEW.name) from country_name where country_name.country_code = lower(NEW.country_code) INTO NEW.name;
+         SELECT name FROM country_name WHERE country_code = lower(NEW.country_code) INTO existing;
+         IF existing.name IS NOT NULL THEN
+             NEW.name = existing.name || NEW.name;
+         END IF;
      END IF;
        
      -- Have we already done this place?
@@@ -2399,7 -2402,7 +2402,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,calculated_country_code,postcode
        from place_addressline join placex on (address_place_id = placex.place_id)