From 43869b9938a25f87481d6ecd0654906a9627e7aa Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 2 Jul 2017 16:28:02 +0200 Subject: [PATCH] make sure postcode gets recomputed on update --- sql/functions.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/functions.sql b/sql/functions.sql index 573e80e7..1c4fbb64 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -1272,6 +1272,7 @@ BEGIN -- cheaper but less acurate place_centroid := ST_PointOnSurface(NEW.geometry); NEW.centroid := null; + NEW.postcode := null; --DEBUG: RAISE WARNING 'Computing preliminary centroid at %',ST_AsText(place_centroid); -- recalculate country and partition @@ -1512,7 +1513,7 @@ BEGIN IF NEW.address is not null AND NEW.address ? 'postcode' THEN NEW.postcode = NEW.address->'postcode'; ELSE - SELECT postcode FROM placex WHERE place_id = parent_place_id INTO NEW.postcode; + SELECT postcode FROM placex WHERE place_id = NEW.parent_place_id INTO NEW.postcode; END IF; IF NEW.postcode is null THEN NEW.postcode := get_nearest_postcode(NEW.country_code, place_centroid); -- 2.39.5