Skip to content

Commit

Permalink
Merge pull request #3174 from lonvia/osm2pgsql-update-fix
Browse files Browse the repository at this point in the history
Be more precise on what is deleted on updates
  • Loading branch information
lonvia authored Aug 25, 2023
2 parents d5b6042 + c5f5ab5 commit f3809a5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib-sql/functions/place_triggers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions test/bdd/osm2pgsql/update/tags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

0 comments on commit f3809a5

Please sign in to comment.