From 26dfb868e943bba3fde8c271f02faf1150c33644 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Fri, 25 Aug 2023 08:45:47 +0200 Subject: [PATCH 1/2] add test case for bad update --- test/bdd/osm2pgsql/update/tags.feature | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/bdd/osm2pgsql/update/tags.feature b/test/bdd/osm2pgsql/update/tags.feature index 3d083040..e2fd665a 100644 --- a/test/bdd/osm2pgsql/update/tags.feature +++ b/test/bdd/osm2pgsql/update/tags.feature @@ -488,3 +488,26 @@ Feature: Tag evaluation Then placex contains exactly | object | type | admin_level | | R10:boundary | informal | 4 | + + + Scenario: Main tag and geometry is changed + When loading osm data + """ + n1 x40 y40 + n2 x40.0001 y40 + n3 x40.0001 y40.0001 + n4 x40 y40.0001 + w5 Tbuilding=house,name=Foo Nn1,n2,n3,n4,n1 + """ + Then place contains exactly + | object | type | + | W5:building | house | + + When updating osm data + """ + n1 x39.999 y40 + w5 Tbuilding=terrace,name=Bar Nn1,n2,n3,n4,n1 + """ + Then place contains exactly + | object | type | + | W5:building | terrace | From c5f5ab5363a9d466af334a7019604fadae805b78 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Fri, 25 Aug 2023 14:20:27 +0200 Subject: [PATCH 2/2] be more strict about removal from place_to_be_deleted If the type of a place is changed and then the same insert issued again, the old data will effectively remain in the table. Fixed #3168. --- lib-sql/functions/place_triggers.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib-sql/functions/place_triggers.sql b/lib-sql/functions/place_triggers.sql index 6a52021b..3def6596 100644 --- a/lib-sql/functions/place_triggers.sql +++ b/lib-sql/functions/place_triggers.sql @@ -37,7 +37,7 @@ BEGIN -- Remove the place from the list of places to be deleted DELETE FROM place_to_be_deleted pdel WHERE pdel.osm_type = NEW.osm_type and pdel.osm_id = NEW.osm_id - and pdel.class = NEW.class; + and pdel.class = NEW.class and pdel.type = NEW.type; -- Have we already done this place? SELECT * INTO existing