<div dir="ltr"><div>Hi Jukka, see answer inline:<br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-09-07 16:48 GMT+02:00 jratike80 <span dir="ltr"><<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi" target="_blank">jukka.rahkonen@maanmittauslaitos.fi</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi César,<br>
<br>
What are the problems you face when editing such layer? </blockquote><div><br></div><div><br></div><div>If you later try to add a new record to the layer without providing an id, it will raise an error, defeating the purpose of having a serial PK. For instance:</div><div><br></div><div>INSERT INTO test1 (wkb_geometry)</div><div>VALUES (ST_GeomFromText('MULTIPOINT(-5.34510248270791 36.1506091987899)', 4258)) ;</div><div><br></div><div>ERROR: duplicate key value violates unique constraint "test1_pkey"<br>SQL state: 23505<br>Detail: Key (ogc_fid)=(1) already exists.</div><div><br></div><div>They you must provide the ogc_fid by hand:</div><div><br></div><div><div>INSERT INTO test1 (ogc_fid, wkb_geometry)</div><div>VALUES (102, ST_GeomFromText('MULTIPOINT(-5.34510248270791 36.1506091987899)', 4258)) ;</div></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Do you have an<br>
alternative suggestion about what to do for the sequence?<br></blockquote><div><br></div><div>The sequence should be initialized in the same way as it is done when -preserve_fid is not provided.</div><div>For the layer & sequence in the example, the following SQL statement would work:</div><div><br></div><div>SELECT set_val('test1_ogc_fid_seq', max(ogc_fid)) FROM test1 ;</div><div><br></div><div>César<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
-Jukka Rahkonen-<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html" rel="noreferrer" target="_blank">http://osgeo-org.1560.x6.<wbr>nabble.com/GDAL-Dev-f3742093.<wbr>html</a><br>
______________________________<wbr>_________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/gdal-dev</a></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">SCOLAB<br><a href="http://scolab.es" target="_blank">http://scolab.es</a></div>
</div></div>