[QGIS-Developer] Geopackage FID columns: i HATE them!!!!

Jeremy Palmer palmerjnz at gmail.com
Sat Mar 21 17:02:21 PDT 2020

On Fri, Mar 20, 2020 at 6:04 PM matteo <matteo.ghetta at gmail.com> wrote:

> +1000 from an user perspective the fid is really confusing. The user
> seems to be able to delete/edit the column but (of course) touching it
> will throw an error when saving.
> Moreover, it happens that during format conversion in the attribute
> table there are fid/pk/id columns, with same numbers.
I can imagine it is frustrating for users. It would be better not to have
the system fid at all.

We originally asked for this feature to be implemented in QGIS a few years
back - so we are to blame! Our issue was GeoPackage files were being
created from a data service with the source data primary key set as the
FID, and we couldn’t see this PK data in QGIS. This situation has now
changed, and the fid and source primary keys are both in the GPKG now.
However, the other issue with removing the fid column, is we have python
scripts using GDAL, creating GeoPackages with the layer creation options of
FID=id. This was so we can easily apply change-sets the database using the
GDAL Python API of `layer.GetFeature(fid)` rather than having to use
`layer.SetAttributeFilter(‘ID=XXX’)` (which also requires the creation of a
user index to be efficient). We also support PostGIS, MSSQL, and FileGDB
data sources in this same way. Happy if people have some thoughts on better
ways to do this :-) Maybe we can change QGIS only to display the GPKG FID
if it is not set to ‘fid”? I guess there might be other issues with that
approach in terms of editing...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200322/baf8693c/attachment.html>

More information about the QGIS-Developer mailing list