+ -- We must always increase the address level relative to the admin boundary.
+ IF NEW.class = 'boundary' and NEW.type = 'administrative' THEN
+ parent_address_level := get_parent_address_level(NEW.geometry, NEW.admin_level);
+ IF parent_address_level >= NEW.rank_address THEN
+ NEW.rank_address := parent_address_level + 2;
+ END IF;
+ ELSE
+ parent_address_level := 3;
+ END IF;