Bug report #13877
Avoid modification of PostGIS table without primary key
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | Jürgen Fischer | ||
Category: | Data Provider/PostGIS | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | invalid |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 21900 |
Description
Add to QGIS a PostGIS layer without primary key (I added a point one).
Toggle to edition such a file remains possible. Do it.
You'll see that the only available tools for edit are "Save modifications" and "Add a feature". And indeed, you can add new features, set their attributes and save with no problem (and these changes are applied in the database). BUT:
- You can't change attributes of already existing features
- since all other tools are not available, there's no way to change geometries (move, add part, remove..)
- In the table I use there's a serial column. This field needs the attribute table dialog to be closed before it shows new values.
Is there a reason to allow modification with so many restrictions?
History
#1 Updated by Jürgen Fischer almost 9 years ago
- Resolution set to invalid
- Status changed from Open to Closed
Without a primary key we cannot tell the database which row you want to modify or delete.
#2 Updated by Harrissou Santanna almost 9 years ago
Yes, I suspected that. So shouldn't it rather be impossible to the user to toggle this layer into edition?
It's weird to have the layer editable with this strange behaviour... Are there use cases of this behaviour?
#3 Updated by Jürgen Fischer almost 9 years ago
Harrissou Santanna wrote:
Yes, I suspected that. So shouldn't it rather be impossible to the user to toggle this layer into edition?
It's weird to have the layer editable with this strange behaviour... Are there use cases of this behaviour?
Sure, you might have been granted only INSERT right, but not DELETE or UPDATE. That would look the same.