From 4c19762e337594c0cc33a395cea97eb0b9cd507a Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 8 Feb 2024 10:21:48 +0100 Subject: [PATCH] extratags should become null when empty Removing the artifical entries in the extratags may lead to an empty hstore. Set it to null in that case. Fixes #3055. --- lib-sql/functions/placex_triggers.sql | 5 ++++- test/bdd/db/update/linked_places.feature | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib-sql/functions/placex_triggers.sql b/lib-sql/functions/placex_triggers.sql index 841b7fd6..530bf541 100644 --- a/lib-sql/functions/placex_triggers.sql +++ b/lib-sql/functions/placex_triggers.sql @@ -2,7 +2,7 @@ -- -- This file is part of Nominatim. (https://nominatim.org) -- --- Copyright (C) 2022 by the Nominatim developer community. +-- Copyright (C) 2024 by the Nominatim developer community. -- For a full list of authors see the git log. -- Trigger functions for the placex table. @@ -794,6 +794,9 @@ BEGIN result := deleteLocationArea(NEW.partition, NEW.place_id, NEW.rank_search); NEW.extratags := NEW.extratags - 'linked_place'::TEXT; + IF NEW.extratags = ''::hstore THEN + NEW.extratags := NULL; + END IF; -- NEW.linked_place_id contains the precomputed linkee. Save this and restore -- the previous link status. diff --git a/test/bdd/db/update/linked_places.feature b/test/bdd/db/update/linked_places.feature index 539d9285..9204b3bb 100644 --- a/test/bdd/db/update/linked_places.feature +++ b/test/bdd/db/update/linked_places.feature @@ -258,7 +258,7 @@ Feature: Updates of linked places When marking for delete N1 Then placex contains | object | extratags | - | R1 | | + | R1 | - | Scenario: Update linked_place info when linkee type changes Given the 0.1 grid -- 2.45.1