Bug report #4361
Edit button is not updated when provider query makes a layer read-only
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||All||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||end of life|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||14294|
Quoting from a mention in #3052:
As soon as you place a query on a shapefile, it's capabilities drop from 975 to 704, which raises "Provider cannot be opened for editing".
Creating a query also creates an inconsistency in the UI:
Whilst the editing pen is still blue in the toolbar, it's already greyed out in the attributes table. Clicking the pen in the toolbar raises aforementioned error and stalls it in grey. Removing the query doesn't solve this issue. Opening the attributes table again, the pen is blue there.
So it seems, the toolbar's symbol is not up to date.
975 and 704 equal:
[[PyQt]]4.QtCore.QString(u'Add Features, Delete Features, Change Attribute Values, Add Attributes, Create Spatial Index, Fast Access to Features at ID, Change Geometries') and [[PyQt]]4.QtCore.QString(u'Create Spatial Index, Fast Access to Features at ID')
That description isn't completely accurate - the button isn't "already" greyed out in the attribute table. If you open the attribute table after the query is set, then it will be greyed out. If you open it after the query is removed, it will not be greyed out. The button doesn't update in an attribute table that is already open.
- If a provider doesn't support attribute updates (e.g. the attached example vrt using a csv file), then the edit button will always be greyed out in the attribute table. So if you set a query on the layer, then try to enable editing, the button will grey out, and to be able to edit the layer you will need to remove the query and either save and reopen the project, or remove the layer and add it again.
- The error message when you try to enable editing with a query set doesn't actually identify the problem, so most users probably wouldn't know how to deal with it:
Start editing failed Provider cannot be opened for editing
#8 Updated by Giovanni Manghi over 2 years ago
- Status changed from Open to Closed
- Resolution set to end of life
End of life notice: QGIS 2.18 LTR