<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>As far as I know, Nyall Dawson is currently working on fixing this, as part of his work on unique value constraints (provider provided or qgis provided where the provider doesn't support it). But not sure about the details. Certainly, PostgreSQL and Geopackage are top priorities for that. And his work targets QGIS 3.x, not for 2.x</p>
<p>Greetings,</p>
<p>Andreas</p>
<p> </p>
<p>On 2016-10-19 14:43, Even Rouault wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Le mercredi 19 octobre 2016 14:14:40, Chris Buckmaster a écrit :
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">Hi<br /><br /> I have a geopackage polygon layer and I am trying to split a simple feature<br /> within it.<br /><br /> When I try to do it, I get an error message 'failed to insert, UNIQUE<br /> constraint failed'.<br /><br /> Is this a known issue with splitting features using the geopackage format,<br /> it could it be how the layer is set up?</blockquote>
<br /> No, it is due to the fact that when splitting the feature, the newly created <br /> feature receives the same 'fid' value (the first column in the attribute table) <br /> as the other part, and that when creating the feature, the fid, when set, is <br /> honoured. Hence given the duplication of fid, the failure. Before saving the <br /> edits, you can manually unset the fid.<br /><br /> Although something should probably be done either in the splitting tool to <br /> unset the fid column of the new feature. Or perhaps the provider could be made <br /> more tolerant in the case of duplicated FID to assign a new one.<br /><br /> This could happen for other formats handled by OGR like spatialite (if not <br /> going throug the QGIS spatialite provider), FileGDB, etc...<br /><br /> Would probably deserve a ticket in the bug tracker.<br /><br /> Even</div>
</blockquote>
<p> </p>
<div> </div>
</body></html>