Devs,
I need get the name field of Feature Index of vector file. For Shapefile provider, i can use the string "FID". But, the database provider, example Postgis or Spatialite, i need find the name field of Primary key use for FID. I don't find the methods in classes QgsVectorLayer and QgsDataprovider In OGR i have the method "GetFIDColumn" (i don't test). The idea is add in canvas the layer with FID's selected from layer. The example of script to use in python console QGIS: from qgis import core, gui lyr = qgis.utils.iface.mapCanvas().currentLayer() addLyr = core.QgsVectorLayer(lyr.source(), "test_subset", lyr.providerType()) addLyr.setSubsetString("FID IN (0,1,2)") core.QgsMapLayerRegistry.instance().addMapLayer(addLyr) The script run in shapefile, but, i need find the name of "Key" in layer from database. Regards, Luiz Motta _______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer