[osmosis-dev] node_tags duplicate key with MySQL varbinary

Simon Nuttall simon.nuttall at gmail.com
Wed Jul 20 08:55:47 BST 2011


I'm using this line to fill a MySQL database of Europe:

osmosis -v 100 --read-bin europe.osm.pbf --tag-filter accept-ways
highway=* cycleway=* access=* foot=* bicycle=* oneway=* --tag-filter
reject-ways highway=motorway,motorway_link --buffer --write-apidb
dbType=mysql populateCurrentTables=no database=planetExtractOSM110718
validateSchemaVersion=no


When the node_tags table had this definition for the 'k' field...

`k` varchar(255) binary NOT NULL default '',

... it failed because version 4 of...

http://www.openstreetmap.org/browse/node/778149001

had a duplicated 'k' that had a trailing space (i.e. "shop" =
"clothes" ... and "shop "= "boutique").


So I changed the definition to use:

  `k` varbinary(255) NOT NULL default '',

but the problem I now hit (after about 28 hours of processing) is:


    Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Duplicate entry '1207174847-4-??????' for key 'PRIMARY'
    Offending node:
    http://www.openstreetmap.org/browse/node/1207174847

mysql> select `id`, `version`, `k`, `v` from node_tags where id=1207174847;
+------------+---------+---------+-------------+
| id         | version | k       | v           |
+------------+---------+---------+-------------+
| 1207174847 |       4 | ??????  | 20-?? ????? |
| 1207174847 |       4 | amenity | grave_yard  |
| 1207174847 |       4 | name    | 3?          |
+------------+---------+---------+-------------+
3 rows in set (0.00 sec)


I get the feeling that VARBINARY is the wrong solution and that
VARCHAR BINARY is better, but if so how can I avoid hitting the
trailing space issue again?



More information about the osmosis-dev mailing list