]> git.openstreetmap.org Git - nominatim.git/commitdiff
normalize postcodes before adding to location tables
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 2 Jul 2017 09:32:32 +0000 (11:32 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sat, 19 Aug 2017 17:37:05 +0000 (19:37 +0200)
sql/functions.sql

index 449187742363b1debdf43d242b0e282a1f2cba66..1940ea75786f727183f45244b328b4bce7bb4613 100644 (file)
@@ -617,10 +617,9 @@ BEGIN
   x := deleteLocationArea(partition, place_id, rank_search);
 
   -- add postcode only if it contains a single entry, i.e. ignore postcode lists
-  IF in_postcode IS NULL OR in_postcode similar to '%(,|;)%' THEN
-      postcode := NULL;
-  ELSE
-      postcode := in_postcode;
+  postcode := NULL;
+  IF in_postcode is not null AND in_postcode not similar to '%(,|;)%' THEN
+      postcode := upper(trim (both ' ' from in_postcode));
   END IF;
 
   IF ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') THEN