- -- Did we gain a wikipedia tag in the process? then we need to recalculate our importance
- IF NEW.importance is null THEN
- select language||':'||title,importance from get_wikipedia_match(NEW.extratags, NEW.country_code) INTO NEW.wikipedia,NEW.importance;
+ -- Use the maximum importance if a one could be computed from the linked object.
+ IF linked_importance is not null AND
+ (NEW.importance is null or NEW.importance < linked_importance) THEN
+ NEW.importance = linked_importance;