omniscale / imposm2

Imports OpenStreetMap data into geo databases
http://imposm.org
Apache License 2.0
116 stars 25 forks source link

duplicate key value violates unique constraint "geometry_columns_pk #40

Open GeoTimber opened 10 years ago

GeoTimber commented 10 years ago

Hello, when I update the mapping file (based on osm bright template) to add some features to a table that were not included previously imposm crashed when i reimport the OSM PBF. Just after the vacuum analyze it dumps me:

Vacuum analyze [16:10:16] optimizing took 13s Traceback (most recent call last): File "/usr/local/bin/imposm", line 9, in load_entry_point('imposm==2.5.0', 'console_scripts', 'imposm')() File "/usr/local/lib/python2.7/dist-packages/imposm/app.py", line 316, in main options.table_prefix_production, options.table_prefix_backup) File "/usr/local/lib/python2.7/dist-packages/imposm/db/postgis.py", line 320, in swap_tables cur.execute('UPDATE geometry_columns SET f_table_name = %s WHERE f_table_name = %s', (rename_to, view_name)) psycopg2.IntegrityError: duplicate key value violates unique constraint "geometry_columns_pk" DETAIL: Key (f_table_catalog, f_table_schema, f_table_name, f_geometry_column)=(, public, osm_old_roads, geometry) already exists.

Something to do with the osm_old_roads already being there, any tips, can I just delete something here before I run imposm again?

Thanks anyway Joris

GeoTimber commented 10 years ago

okay

If I run delete from geometry_columns where f_table_name LIKE 'osm_old%';

before reimporting it is all solved,

I think imposm -U postgres -d ... --remove-backup-tables forgets to delete the road* views

no idea where to add this to imposm itself , maybe someone wants to update imposm?