<div dir="ltr"><div>My multipart split plugin (which I am porting to 3), It breaks multipart features and transforms each part in individual features, copying the attributes from the original feature.<br></div><div><br></div><div>In the process, I need to be careful with the autoincrement primary keys. For PostGIS and Spatialite, asking for the providers pkattributesindex works and I can do the following:</div><div><br></div><div><span style="font-family:monospace"></span></div><span style="font-family:monospace">new_attributes = feature.attributes()<br><br># When attribute is a Primary Key, replace by default value<br>### This is not working well with spatialite provider###<br>for j in provider.pkAttributeIndexes():<br>    if provider.defaultValue(j):<br>        new_attributes[j] = provider.defaultValue(j)<br>    else:<br>        new_attributes[j] = QVariant()</span><br><div><br></div><div>But for geopackage the provider.pkAttributeIndexes() always returns an empty list...</div><div><br></div><div>The above code was copied a long time ago from the split features tools in core. Looking at the code now, there is no longer that part where the provider's primary keys are searched, Nevertheless, the code works and the split features tool leave the pkattributes NULL to be autogenerated. Wasn't able to figure out where that is done now ...</div><div><br></div><div>Thanks,</div><div><br></div><div>Alexandre Neto<br></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Alexandre Neto</div><div>---------------------</div><div>@AlexNetoGeo</div><div><a href="http://sigsemgrilhetas.wordpress.com">http://sigsemgrilhetas.wordpress.com</a></div><a href="http://gisunchained.wordpress.com">http://gisunchained.wordpress.com</a><br></div></div>