-- one with the smallest id because the original node was created first.
-- Ignore all nodes marked for deletion. (Might happen when the type changes.)
select * from placex where osm_type = 'N' and osm_id = waynodes[nodeidpos]::BIGINT
- and indexed_status < 100
+ and indexed_status < 100 and housenumber is not NULL
order by (type = 'address'),place_id limit 1 INTO nextnode;
IF nextnode.place_id IS NOT NULL THEN
END IF;
IF for_place_id IS NULL THEN
- for_place_id := in_place_id;
- select calculated_country_code, housenumber, rank_search, postcode, null from placex where place_id = for_place_id
- INTO searchcountrycode, searchhousenumber, searchrankaddress, searchpostcode, searchhousename;
+ select coalesce(linked_place_id, place_id), calculated_country_code,
+ housenumber, rank_search, postcode, null
+ from placex where place_id = in_place_id
+ INTO for_place_id, searchcountrycode, searchhousenumber, searchrankaddress, searchpostcode, searchhousename;
+ RAISE WARNING '% fffff %', in_place_id, for_place_id;
END IF;
--RAISE WARNING '% % % %',searchcountrycode, searchhousenumber, searchrankaddress, searchpostcode;