osmcode / osm-postgresql-experiments

Experimental code for importing OSM data into PostgreSQL/PostGIS
GNU General Public License v3.0
6 stars 4 forks source link

Add deleted field to primary key of history table #3

Closed frodrigo closed 10 months ago

frodrigo commented 10 months ago

OSM data the version of object does not change on deletion. So the primary key of changes should be objtype, id, version, deleted and not just objtype, id, version.

joto commented 10 months ago

OSM data the version of object does not change on deletion.

Generally it does. If you look into a history file, you can see that there is a new version for the deleted objects. There is a problem with extracts, though. If an object moved out of the area covered by the extract, it isn't deleted really, but for the extract it must look like it is deleted. So a delete record is "faked" and that one doesn't get a new version number to make sure it doesn't clash with the real versions of that object.

But the solution still makes sense for those extracts.