]> granicus.if.org Git - postgis/commitdiff
Get rid of use of array_accum and replace with array_agg (which exists in PostgreSQL...
authorRegina Obe <lr@pcorp.us>
Wed, 6 Jul 2011 00:40:46 +0000 (00:40 +0000)
committerRegina Obe <lr@pcorp.us>
Wed, 6 Jul 2011 00:40:46 +0000 (00:40 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7594 b70326c6-7e19-0410-871a-916f4a2858ee

extras/tiger_geocoder/tiger_2010/geocode/geocode_address.sql
extras/tiger_geocoder/tiger_2010/tiger_loader.sql

index f8aa625d4420502474db9043e269bfb164e87d24..f316d4ab88adc0944900c2aaf11bd0cece755806 100644 (file)
@@ -35,17 +35,17 @@ BEGIN
     (SELECT zip_state.statefp as statefp,$1 as location, true As exact, ARRAY[zip_state.zip] as zip,1 as pref
         FROM zip_state WHERE zip_state.zip = $2 
             AND (' || quote_nullable(in_statefp) || ' IS NULL OR zip_state.statefp = ' || quote_nullable(in_statefp) || ')
-        UNION SELECT zip_state_loc.statefp,zip_state_loc.place As location,false As exact, array_accum(zip_state_loc.zip) AS zip,1 + abs(COALESCE(diff_zip(max(zip), $2),0) - COALESCE(diff_zip(min(zip), $2),0)) As pref
+        UNION SELECT zip_state_loc.statefp,zip_state_loc.place As location,false As exact, array_agg(zip_state_loc.zip) AS zip,1 + abs(COALESCE(diff_zip(max(zip), $2),0) - COALESCE(diff_zip(min(zip), $2),0)) As pref
               FROM zip_state_loc
              WHERE zip_state_loc.statefp = ' || quote_nullable(in_statefp) || ' 
                    AND lower($1) = lower(zip_state_loc.place)
              GROUP BY zip_state_loc.statefp,zip_state_loc.place
-      UNION SELECT zip_state_loc.statefp,zip_state_loc.place As location,false As exact, array_accum(zip_state_loc.zip),3
+      UNION SELECT zip_state_loc.statefp,zip_state_loc.place As location,false As exact, array_agg(zip_state_loc.zip),3
               FROM zip_state_loc
              WHERE zip_state_loc.statefp = ' || quote_nullable(in_statefp) || '
                    AND soundex($1) = soundex(zip_state_loc.place)
              GROUP BY zip_state_loc.statefp,zip_state_loc.place
-      UNION SELECT zip_lookup_base.statefp,zip_lookup_base.city As location,false As exact, array_accum(zip_lookup_base.zip),4
+      UNION SELECT zip_lookup_base.statefp,zip_lookup_base.city As location,false As exact, array_agg(zip_lookup_base.zip),4
               FROM zip_lookup_base
              WHERE zip_lookup_base.statefp = ' || quote_nullable(in_statefp) || '
                          AND (soundex($1) = soundex(zip_lookup_base.city) OR soundex($1) = soundex(zip_lookup_base.county))
@@ -57,17 +57,17 @@ BEGIN
     (SELECT zip_state.statefp as statefp,parsed.location as location, true As exact, ARRAY[zip_state.zip] as zip,1 as pref
         FROM zip_state WHERE zip_state.zip = parsed.zip 
             AND (in_statefp IS NULL OR zip_state.statefp = in_statefp)
-        UNION SELECT zip_state_loc.statefp,parsed.location,false As exact, array_accum(zip_state_loc.zip),2 + diff_zip(zip[1], parsed.zip)
+        UNION SELECT zip_state_loc.statefp,parsed.location,false As exact, array_agg(zip_state_loc.zip),2 + diff_zip(zip[1], parsed.zip)
               FROM zip_state_loc
              WHERE zip_state_loc.statefp = in_statefp
                    AND lower(parsed.location) = lower(zip_state_loc.place)
              GROUP BY zip_state_loc.statefp,parsed.location
-      UNION SELECT zip_state_loc.statefp,parsed.location,false As exact, array_accum(zip_state_loc.zip),3
+      UNION SELECT zip_state_loc.statefp,parsed.location,false As exact, array_agg(zip_state_loc.zip),3
               FROM zip_state_loc
              WHERE zip_state_loc.statefp = in_statefp
                    AND soundex(parsed.location) = soundex(zip_state_loc.place)
              GROUP BY zip_state_loc.statefp,parsed.location
-      UNION SELECT zip_lookup_base.statefp,parsed.location,false As exact, array_accum(zip_lookup_base.zip),4
+      UNION SELECT zip_lookup_base.statefp,parsed.location,false As exact, array_agg(zip_lookup_base.zip),4
               FROM zip_lookup_base
              WHERE zip_lookup_base.statefp = in_statefp
                          AND (soundex(parsed.location) = soundex(zip_lookup_base.city) OR soundex(parsed.location) = soundex(zip_lookup_base.county))
index 277ceccf414d8607f9dff0e1f07881156bbbff04..fb336b9743184eb0794e1bc03e31ca1703f49e34 100644 (file)
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 SET search_path TO tiger,public;
 BEGIN;
-DROP AGGREGATE IF EXISTS array_accum(anyelement);
-CREATE AGGREGATE array_accum(anyelement) (
-  SFUNC=array_append,
-  STYPE=anyarray,
-  INITCOND='{}'
-);
 CREATE OR REPLACE FUNCTION loader_macro_replace(param_input text, param_keys text[],param_values text[]) 
 RETURNS text AS
 $$