ERROR: column co.statefp does not exist LINE 2: ...cefp = p.placefp) LEFT JOIN county co ON ('25' = co.statefp... ^ QUERY: SELECT DISTINCT ON (sub.predirabrv, sub.fename, COALESCE(sub.suftypabrv, sub.pretypabrv) , sub.sufdirabrv, coalesce(p.name,zip.city,cs.name,co.name), s.stusps,sub.zip) sub.predirabrv as fedirp, sub.fename, COALESCE(sub.suftypabrv, sub.pretypabrv) as fetype, sub.sufdirabrv as fedirs, coalesce(p.name,zip.city,cs.name,co.name)::varchar as place, s.stusps as state, sub.zip as zip, interpolate_from_address($1, sub.fromhn, sub.tohn, e.the_geom, sub.side) as address_geom, sub.sub_rating + least((coalesce(diff_zip($7 , sub.zip),0) *1.00/2)::integer, coalesce(levenshtein_ignore_case($7, sub.zip),0) ) + coalesce(least(levenshtein_ignore_case($3, coalesce(p.name,zip.city,cs.name,co.name)), levenshtein_ignore_case($3, coalesce(cs.name,co.name))),5) as sub_rating, sub.exact_address as exact_address FROM ( SELECT a.tlid, predirabrv, COALESCE(a.prequalabr || ' ','' ) || a.name As fename, suftypabrv, sufdirabrv, fromhn, tohn, side, a.statefp, zip, rate_attributes($5, a.predirabrv, $2, a.name , $4, a.suftypabrv, $6, a.sufdirabrv, a.prequalabr) + CASE WHEN $1::integer IS NULL OR b.fromhn IS NULL THEN 20 WHEN $1::integer >= least_hn(b.fromhn, b.tohn) AND $1::integer <= greatest_hn(b.fromhn,b.tohn) AND ($1::integer % 2) = (to_number(b.fromhn,'99999999') % 2)::integer THEN 0 WHEN $1::integer >= least_hn(b.fromhn,b.tohn) AND $1::integer <= greatest_hn(b.fromhn,b.tohn) THEN 2 ELSE ((1.0 - (least_hn($1::text,least_hn(b.fromhn,b.tohn)::text)::numeric / greatest(1,greatest_hn($1::text,greatest_hn(b.fromhn,b.tohn)::text)))) * 5)::integer + 5 END as sub_rating, $1::integer >= least_hn(b.fromhn,b.tohn) AND $1::integer <= greatest_hn(b.fromhn,b.tohn) AND ($1 % 2)::numeric::integer = (to_number(b.fromhn,'99999999') % 2) as exact_address, a.name, a.prequalabr, a.pretypabrv FROM featnames a join addr b ON (a.tlid = b.tlid AND a.statefp = b.statefp ) WHERE a.statefp = '25' AND a.mtfcc LIKE 'S%' AND b.zip IN ('02109') AND ( lower($2) = lower(a.name) OR ( a.prequalabr > '' AND trim(lower($2), lower(a.prequalabr) || ' ') = lower(a.name) ) OR numeric_streets_equal($2, a.name) ) ORDER BY 11 LIMIT 20 ) AS sub JOIN edges e ON ('25' = e.statefp AND sub.tlid = e.tlid AND e.mtfcc LIKE 'S%' ) JOIN state s ON ('25' = s.statefp) JOIN faces f ON ('25' = f.statefp AND (e.tfidl = f.tfid OR e.tfidr = f.tfid)) LEFT JOIN zip_lookup_base zip ON (sub.zip = zip.zip AND zip.statefp='25') LEFT JOIN place p ON ('25' = p.statefp AND f.placefp = p.placefp) LEFT JOIN county co ON ('25' = co.statefp AND f.countyfp = co.countyfp) LEFT JOIN cousub cs ON ('25' = cs.statefp AND cs.cosbidfp = sub.statefp || co.countyfp || f.cousubfp) WHERE ( (sub.side = 'L' and e.tfidl = f.tfid) OR (sub.side = 'R' and e.tfidr = f.tfid) ) ORDER BY 1,2,3,4,5,6,7,9 LIMIT 10 CONTEXT: PL/pgSQL function geocode_address(norm_addy,integer,geometry) line 383 at FOR over EXECUTE statement PL/pgSQL function geocode(norm_addy,integer,geometry) line 14 at FOR over SELECT rows PL/pgSQL function geocode(character varying,integer,geometry) line 26 at RETURN QUERY ********** Error ********** ERROR: column co.statefp does not exist SQL state: 42703 Context: PL/pgSQL function geocode_address(norm_addy,integer,geometry) line 383 at FOR over EXECUTE statement PL/pgSQL function geocode(norm_addy,integer,geometry) line 14 at FOR over SELECT rows PL/pgSQL function geocode(character varying,integer,geometry) line 26 at RETURN QUERY