Hi Lauri, 1- Disable or remove unique key (UK) on table. 2- Import data using shp2pgsql 3- remove duplicate rows using SQL DELETE FROM sometable WHERE someuniquekey NOT IN (SELECT MAX(dup.someuniquekey) FROM sometable As dup GROUP BY dup.dupcolumn1, dup.dupcolumn2, dup.dupcolum3)
(http://www.postgresonline.com/journal/archives/22-Deleting-Duplicate-Records-in-a-Table.html) 4- Enforce UK -Imran --- On Tue, 1/3/12, Lauri Kajan <lauri.ka...@gmail.com> wrote: > From: Lauri Kajan <lauri.ka...@gmail.com> > Subject: [postgis-users] shp2pgsql - how to continue when error occurs > To: postgis-users@postgis.refractions.net > Date: Tuesday, January 3, 2012, 1:18 PM > Hi all, > > I'm trying to merge multiple shapefiles to postgis table. I > know that > there is some duplicates in different files. > > I thought that I could just check duplicatiness when > loading shapes > with shp2pgsql. > So I first created an empty table and added a unique > constraint to the > field that I know to be unique with non duplicate records. > > But now when shp2pgsql tries to insert first duplicate > record and > error occurs it stops and won't load any records. > > Is there a way to continue when "key already exists" -error > occurs? > > I read that in shp2pgsql that comes with 2.0 it has -e > parameter that > loads each record invidually. Is this the only way to go? > Don't like > that cause I have 13GB shape files. And I would like to use > Dump > dormat. > > > > Thanks > > -Lauri > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users