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 

Greetings, 

Andreas 

On 2016-10-19 14:43, Even Rouault wrote:

> Le mercredi 19 octobre 2016 14:14:40, Chris Buckmaster a écrit : 
> 
>> Hi
>> 
>> I have a geopackage polygon layer and I am trying to split a simple feature
>> within it.
>> 
>> When I try to do it, I get an error message 'failed to insert, UNIQUE
>> constraint failed'.
>> 
>> Is this a known issue with splitting features using the geopackage format,
>> it could it be how the layer is set up?
> 
> No, it is due to the fact that when splitting the feature, the newly created 
> feature receives the same 'fid' value (the first column in the attribute 
> table) 
> as the other part, and that when creating the feature, the fid, when set, is 
> honoured. Hence given the duplication of fid, the failure. Before saving the 
> edits, you can manually unset the fid.
> 
> Although something should probably be done either in the splitting tool to 
> unset the fid column of the new feature. Or perhaps the provider could be 
> made 
> more tolerant in the case of duplicated FID to assign a new one.
> 
> This could happen for other formats handled by OGR like spatialite (if not 
> going throug the QGIS spatialite provider), FileGDB, etc...
> 
> Would probably deserve a ticket in the bug tracker.
> 
> Even

  
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to