don't delete names on unknown country boundaries

If a country boundary has a country_code that is unknown to
Nominatim, it would delete all names because the coalascing
with country_name would not yield any result.
This commit is contained in:
Sarah Hoffmann
2017-02-18 13:51:21 +01:00
parent 679e4c47ce
commit c897b96c41
2 changed files with 38 additions and 2 deletions

View File

@@ -1988,7 +1988,10 @@ BEGIN
-- 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?