From 6cc6cf950c3c08103e6159a079c85b5a4f1c09fa Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 26 Apr 2020 00:14:55 +0200 Subject: [PATCH] ensure that result object name is always first in display_name The display name might be mixed up if the result object has a lower rank_address than its address members. --- sql/functions/address_lookup.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/functions/address_lookup.sql b/sql/functions/address_lookup.sql index 9a4c630c..f8659c70 100644 --- a/sql/functions/address_lookup.sql +++ b/sql/functions/address_lookup.sql @@ -60,7 +60,9 @@ BEGIN prevresult := ''; FOR location IN - SELECT * FROM get_addressdata(for_place_id, housenumber) + SELECT name, + CASE WHEN place_id = for_place_id THEN 99 ELSE rank_address END as rank_address + FROM get_addressdata(for_place_id, housenumber) WHERE isaddress order by rank_address desc LOOP currresult := trim(get_name_by_language(location.name, languagepref)); -- 2.39.5