[osmosis-dev] duplicate key value violates unique constraint

Martin Schafran martin at ampelmeter.com
Wed Apr 3 18:52:08 UTC 2013


hi,

i'm trying to import the apidb v06 and get this unique constraint error.
my db is postgresql 9.1 and i use osmosis 0.42.

the database is after running rake db:migrate empty except the migration 
table.

 ERROR: duplicate key value violates unique constraint "current_nodes_pkey1"
  Detail: Key (id)=(21402303) already exists.


I tried the import from two different xml files.
the first node entry in the file a.osm is 21402303 and is reported as violated 
constraint.
the first node entry in the file b.osm is 12 and is reported as violated 
constraint.
it seems as the first node has been already inserted some where else or the 
database is buggy.

current_nodes are populated from nodes with this statement in ApidbWriter:
"INSERT INTO current_nodes SELECT node_id, latitude, longitude, changeset_id, 
visible, timestamp, tile, version"
            + " FROM nodes WHERE node_id >= ? AND node_id < ?";


and in nodes there is only one entry where id=21402303,
so duplicates are impossible.

any ideas, what is going on?

martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osmosis-dev/attachments/20130403/a2d1a560/attachment.html>


More information about the osmosis-dev mailing list