X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/77f646410e09ab8cff9e039d5e1ef297f503a704..de46b621869b3cec48efdb6520ec29177f267869:/sql/functions.sql

diff --git a/sql/functions.sql b/sql/functions.sql
index 3168b338..554ddf32 100644
--- a/sql/functions.sql
+++ b/sql/functions.sql
@@ -598,8 +598,8 @@ BEGIN
     isArea := true;
     centroid := ST_Centroid(geometry);
 
-    FOR geometry IN select split_geometry(geometry) as geometry LOOP
-      x := insertLocationAreaLarge(partition, place_id, country_code, keywords, rank_search, rank_address, false, centroid, geometry);
+    FOR secgeo IN select split_geometry(geometry) AS geom LOOP
+      x := insertLocationAreaLarge(partition, place_id, country_code, keywords, rank_search, rank_address, false, centroid, secgeo);
     END LOOP;
 
   ELSEIF rank_search < 26 THEN
@@ -1630,7 +1630,7 @@ BEGIN
     location_rank_search := 100;
     location_distance := 0;
 -- RAISE WARNING '  getNearFeatures(%,''%'',%,''%'')',NEW.partition, place_centroid, search_maxrank, isin_tokens;
-    FOR location IN SELECT distinct * from getNearFeatures(NEW.partition, place_centroid, search_maxrank, isin_tokens) LOOP
+    FOR location IN SELECT * from getNearFeatures(NEW.partition, place_centroid, search_maxrank, isin_tokens) LOOP
 
 --RAISE WARNING '  AREA: %',location;
 
@@ -1662,7 +1662,7 @@ BEGIN
       FOR i IN 1..array_upper(isin_tokens, 1) LOOP
 --RAISE WARNING '  getNearestNamedFeature: % % % %',NEW.partition, place_centroid, search_maxrank, isin_tokens[i];
 
-        FOR location IN SELECT distinct * from getNearestNamedFeature(NEW.partition, place_centroid, search_maxrank, isin_tokens[i]) LOOP
+        FOR location IN SELECT * from getNearestNamedFeature(NEW.partition, place_centroid, search_maxrank, isin_tokens[i]) LOOP
 
 --RAISE WARNING '  ISIN: %',location;
 
@@ -2878,10 +2878,10 @@ BEGIN
     IF st_intersects(geometry, secbox) THEN
       secgeo := st_intersection(geometry, secbox);
       IF NOT ST_IsEmpty(secgeo) AND ST_GeometryType(secgeo) in ('ST_Polygon','ST_MultiPolygon') THEN
-        FOR geo IN select quad_split_geometry(secgeo, maxarea, remainingdepth) as geometry LOOP
-          IF NOT ST_IsEmpty(geo.geometry) AND ST_GeometryType(geo.geometry) in ('ST_Polygon','ST_MultiPolygon') THEN
+        FOR geo IN select quad_split_geometry(secgeo, maxarea, remainingdepth) as geom LOOP
+          IF NOT ST_IsEmpty(geo.geom) AND ST_GeometryType(geo.geom) in ('ST_Polygon','ST_MultiPolygon') THEN
             added := added + 1;
-            RETURN NEXT geo.geometry;
+            RETURN NEXT geo.geom;
           END IF;
         END LOOP;
       END IF;
@@ -2900,8 +2900,8 @@ DECLARE
   geo RECORD;
 BEGIN
   -- 10000000000 is ~~ 1x1 degree
-  FOR geo IN select quad_split_geometry(geometry, 0.25, 20) as geometry LOOP
-    RETURN NEXT geo.geometry;
+  FOR geo IN select quad_split_geometry(geometry, 0.25, 20) as geom LOOP
+    RETURN NEXT geo.geom;
   END LOOP;
   RETURN;
 END;
