From c2417dd1c46f6a1a22a56fee75d858fdb297a267 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 24 Mar 2014 13:01:20 +0100 Subject: [PATCH] update ref for postcode boundaries Fixes https://trac.openstreetmap.org/ticket/5140 --- sql/functions.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sql/functions.sql b/sql/functions.sql index 62847e39..a102078e 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -2258,6 +2258,16 @@ BEGIN geometry = NEW.geometry where osm_type = NEW.osm_type and osm_id = NEW.osm_id and class = NEW.class and type = NEW.type; + IF NEW.class in ('place','boundary') AND NEW.type in ('postcode','postal_code') THEN + IF NEW.postcode IS NULL THEN + -- postcode was deleted, no longer retain in placex + DELETE FROM placex where place_id = existingplacex.place_id; + RETURN NULL; + END IF; + + NEW.name := hstore('ref', NEW.postcode); + END IF; + update placex set name = NEW.name, housenumber = NEW.housenumber, -- 2.45.2