[gdal-dev] export to postgis, ogc_fid_seq

Even Rouault even.rouault at mines-paris.org
Sun Aug 3 01:30:14 PDT 2014


Le dimanche 03 août 2014 00:14:30, Martin Landa a écrit :
> Hi,
> 
> when exporting features to PostGIS layer (python script) I discovered
> that ogc_fid_seq is not updated.
> 
> Eg.
> 
> 
> select last_value from stavebniobjekty_ogc_fid_seq;
>  last_value
> ------------
>           1
> select max(ogc_fid) from stavebniobjekty;
>  max
> ------
>  2572
> 
> Any idea what is missing in my script? Thanks, Martin

Does your script explicitely set the FID before calling CreateFeature() ? If 
so, then the COPY (or INSERT if you use PG_USE_COPY = NO, but both have the 
same effect) will explicitely affect the ogc_fid column of the features, which 
has the effect of not incrementing the sequence.
You likely need to explicitely call setval()


-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list