#1035 gluing on .0 is making least check always return 0.

git-svn-id: http://svn.osgeo.org/postgis/trunk@7419 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Regina Obe 2011-06-18 05:15:50 +00:00
parent bfa9b8bf90
commit 1e4f6b73d8

View file

@ -8,6 +8,7 @@ DECLARE
stmt VARCHAR;
in_statefp VARCHAR;
exact_street boolean := false;
var_debug boolean := false;
BEGIN
IF parsed.streetName IS NULL THEN
-- A street name must be given. Think about it.
@ -78,8 +79,8 @@ BEGIN
|| ' THEN 2'
|| ' ELSE'
|| ' ((1.0 - '
|| '(least_hn(' || coalesce(quote_literal(parsed.address || '.0'),'NULL') || ',least_hn(b.fromhn,b.tohn)::text) /'
|| ' greatest(1,greatest_hn(' || coalesce(quote_literal(parsed.address || '.0'),'NULL') || ',greatest_hn(b.fromhn,b.tohn)::text)))'
|| '(least_hn(' || coalesce(quote_literal(parsed.address),'NULL') || ',least_hn(b.fromhn,b.tohn)::text)::numeric /'
|| ' greatest(1,greatest_hn(' || coalesce(quote_literal(parsed.address),'NULL') || ',greatest_hn(b.fromhn,b.tohn)::text)))'
|| ') * 5)::integer + 5'
|| ' END'
|| ' as sub_rating,'
@ -110,7 +111,9 @@ BEGIN
|| ' ORDER BY 1,2,3,4,5,6,7,9'
|| ' LIMIT 10'
;
--RAISE NOTICE '%', stmt;
IF var_debug THEN
RAISE NOTICE '%', stmt;
END IF;
-- If we got an exact street match then when we hit the non-exact
-- set of tests, just drop out.
IF NOT zip_info.exact AND exact_street THEN
@ -157,6 +160,6 @@ BEGIN
RETURN;
END;
$$
LANGUAGE 'plpgsql' STABLE COST 1000;
LANGUAGE 'plpgsql' STABLE COST 1000 ROWS 50;