<div dir="ltr"><div><div>Hi,<br></div><div><br></div>When loading a layer on PostGIS using ogr2ogr, a sequence is created for the serial primary key.</div><div>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?</div><div><br></div><div>Note that I am using GDAL version 1.11.3.</div><div><br></div><div>Example:</div><div><br></div><div># Using -preserve_fid<br></div><div>ogr2ogr -preserve_fid -update -f PostgreSQL "PG:host='localhost' dbname='test'" myshp.shp  myshp -nln "test1"</div><div><br></div><div></div><div># SELECT last_value from test1_ogc_fid_seq ;<br> last_value <br>------------<br>          1<br>(1 row)<br></div><div><br></div><div># Not using -preserve_fid: sequence properly initialized to 102<br></div><div>ogr2ogr -update -f PostgreSQL "PG:host='localhost' 
dbname='test'" myshp.shp  myshp  -nln "test2"</div><div><br></div><div># SELECT last_value from test2_ogc_fid_seq ;<br> last_value <br>------------<br>        102<br>(1 row)<br></div><div><br></div><div>Thanks in advance,</div><div><br></div><div>César<br></div><div><br>-- <br><div class="gmail_signature">SCOLAB<br><a href="http://scolab.es" target="_blank">http://scolab.es</a></div>
</div></div>