[gdal-dev] GPKG to PostgreSQL, version 2.2.3 vs version 3.0.2

Ari Jolma ari.jolma at gmail.com
Thu Apr 9 01:53:24 PDT 2020


I have this command

ogr2ogr -update -append -f PostgreSQL PG:... merged.gpkg

which works ok in version 3.0.2 (self-compiled) but not in 2.2.3 (from 
ubuntu apt). The error is

ERROR: duplicate key value violates unique constraint "stand_pkey"
DETAIL: Key (id)=(1) already exists.
CONTEXT: COPY stand, line 1
STATEMENT: COPY "stand" ("wkb_geometry", "standid", "parcelid", 
"realestateid", "standnumber", "standnumberextension", "maingroup", 
"subgroup", "fertilityclass", "soiltype", "drainagestate", 
"ditchingyear", "thinningyear", "developmentclass", "standquality", 
"maintreespecies", "accessibility", "standinfo", "datasource", 
"growthplacedatasource", "area", "areadecrease", "creationtime", 
"updatetime") FROM STDIN;

The issue is that "stand_pkey" is "CONSTRAINT stand_pkey PRIMARY KEY 
(id)" made by the

ogr2ogr -overwrite -f PostgreSQL PG:... merged.gpkg

earlier. So it shouldn't be in the COPY data at all (the log does not 
show whether it is there) or there is something wrong with the sequence.

Is there a way to make it work in the older version?

Ari




More information about the gdal-dev mailing list