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

Ari Jolma ari.jolma at gmail.com
Thu Apr 9 23:54:37 PDT 2020


Ari Jolma kirjoitti 9.4.2020 klo 17.23:
> Same outcome.
>
> There's something very strage going on as the max of the id is 305926 
> (after creating the table with the first gpkg) but when I try to 
> manually insert a row to the table it says "key id=39 already exists". 
> If I then manually setval the sequence to 305926 I can add to the table.
>
> So somehow the sequence is lagging behind.


This seems to be the case. v 3.0.2 sends

SELECT setval(pg_get_serial_sequence('"stand"', 'id'), MAX("id") FROM 
"stand";

and similar for other tables but v 2.2.3 does not.

Ari


>
> Ari
>
> jratike80 kirjoitti 9.4.2020 klo 16.14:
>> Hi,
>>
>> I would have a try with -unsetfid. That should be the default when in 
>> append
>> mode but the test is easy.
>>
>> -Jukka Rahkonen-
>>
>>
>> Ari Jolma-2 wrote
>>> 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
>>>
>>>
>>> _______________________________________________
>>> gdal-dev mailing list
>>> gdal-dev at .osgeo
>>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>>
>>
>>
>> -- 
>> Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list