So, I've lost the ability to make edits to a PostGIS layer in QGIS. I'm not sure what has changed with the connection, the only thing that I've done recently was play around with some variations on the layer query. Since I've reverted my query to the original select *
query, the toggle to edit the layer has been greyed out. I'm not sure how to get it back. It doesn't appear that my connection information has changed in anyway, so I'm not sure where to start diagnosing this.
-
To have the edit capabilities on a layer, you must have a unique integer id defined. Maybe this one left with your previous modifications. I suggest you to reload your PostGIS layer, not from explorer but for source manager to select and specify this unique integer field. Hope this helps.– J. MonticoloCommented Jan 29, 2022 at 8:57
-
I had a unique ID assigned, but reloading brought the editing back. Thanks!– nizz0kCommented Jan 29, 2022 at 8:59
2 Answers
Everytime you make changes to a table in postgis, you have to reconnect and readd the layer in qgis in order to be able to see the changes (a side effect of not having the up to date layer in qgis, might result in qgis not allowing you to edit the layer if postgres is the source of the layer).
When uploading a layer from postgis to qgis, it is not the default that you can also edit that layer, as changes should be made at the source (postgis). A workaround is to export the layer to your qgis database, which allows you to edit the newly exported layer.
So, I still don't know what disabled them, but reloading the layer fixed the issue.