[postgis-users] shp2pgsql - how to continue when error occurs

Nithya lakshmi lakshmi.nithya18 at gmail.com
Tue Jan 3 01:50:38 PST 2012


how to use Rtree in postgis

On 1/3/12, Muhammad Imran <imranserver at yahoo.com> wrote:
> 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.kajan at gmail.com> wrote:
>
>> From: Lauri Kajan <lauri.kajan at gmail.com>
>> Subject: [postgis-users] shp2pgsql - how to continue when error occurs
>> To: postgis-users at 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 at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list