From 0ec3fdd3bab67abe3c78cadf362fffa250dd7d34 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 29 Mar 2021 09:36:56 +0200 Subject: [PATCH] return housenumbers always from address field This means that we can use normalized versions of the housenumber in the housenumber field as it is no longer a user visible field. --- lib-sql/functions/address_lookup.sql | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib-sql/functions/address_lookup.sql b/lib-sql/functions/address_lookup.sql index f49bc93e..5ec977d1 100644 --- a/lib-sql/functions/address_lookup.sql +++ b/lib-sql/functions/address_lookup.sql @@ -164,7 +164,10 @@ BEGIN -- POI objects in the placex table IF place IS NULL THEN SELECT parent_place_id as place_id, country_code, - housenumber, postcode, + coalesce(address->'housenumber', + address->'streetnumber', + address->'conscriptionnumber')::text as housenumber, + postcode, class, type, name, address, centroid @@ -178,7 +181,7 @@ BEGIN -- place we should be using instead. IF place IS NULL THEN select coalesce(linked_place_id, place_id) as place_id, country_code, - housenumber, postcode, + null::text as housenumber, postcode, class, type, null as name, address, null as centroid -- 2.39.5