Hi,

When loading a layer on PostGIS using ogr2ogr, a sequence is created for
the serial primary key.
If -preserve_fid paramenter is provided, the sequence start is not properly
initialized (i. e. sequence starts on 1). This leads to problems if the
layer is later edited. Is this an intended behaviour or should be
considered a bug?

Note that I am using GDAL version 1.11.3.

Example:

# Using -preserve_fid
ogr2ogr -preserve_fid -update -f PostgreSQL "PG:host='localhost'
dbname='test'" myshp.shp  myshp -nln "test1"

# SELECT last_value from test1_ogc_fid_seq ;
 last_value
------------
          1
(1 row)

# Not using -preserve_fid: sequence properly initialized to 102
ogr2ogr -update -f PostgreSQL "PG:host='localhost' dbname='test'"
myshp.shp  myshp  -nln "test2"

# SELECT last_value from test2_ogc_fid_seq ;
 last_value
------------
        102
(1 row)

Thanks in advance,

César

-- 
SCOLAB
http://scolab.es
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to