Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot enter attributes and save edits on PostGIS table when user has only the INSERT privilige #40922

Closed
envirosolutionspl opened this issue Jan 9, 2021 · 2 comments · Fixed by #41059
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! PostGIS data provider

Comments

@envirosolutionspl
Copy link

envirosolutionspl commented Jan 9, 2021

New description

When a user has only INSERT privileges on a PostGIS table then he/she cannot save edits because the feature form that pop up after digitizing the geometry does not allow any data entry.

If the table has some defaults set up (like for example the one for the unique PK field) so that mandatory fields are auto-filled then saving edits is possible, clearly demonstrating is not a DB/privileges issue. In this case there is also another issue as the "save edits" icon/button is active in the table of attributes but not in the digitizing toolbar.

Moreover QGIS allows create and save new geometry-less features added from the the attribute table (as there manually entering attributes for the new feature is possible). The same inconsistency with the save button as the previous case occurs.

Old description

When using PostGIS layer users having only select and "INSERT" privileges on that table, there is disabled attribute form showing after geometry drawing. Form occurs but user can't input any values. On the other hand user can insert attributes via attribute table (without geometry) or using form's default values so it is not a database issue. Above form is getting available only when "UPDATE" database privilege is set. So in effect it is not possible to define a user that can only add new features with attributes without permissions of editing existing rows.

How to Reproduce

  1. Create database table with geometry (e.g. point_layer) and at least one extra column (varchar, integer, etc)
  2. Create database user (e.g. test_user) and give him SELECT and INSERT privileges on that table
  3. Connect to the database with QGIS Desktop as test_user and add point_layer to map
  4. Turn on edition mode on point_layer
  5. Add a new feature on a map
  6. Attribute form shows but entering data is not possible, preventing for example entering manually the mandatory PK values and thus preventing saving edits

QGIS and OS versions

Windows, Linux, QGIS 3.16 and 3.10

Additional context

QGIS seems that wants the tables to have also the UPDATE privilege to enable entering new features while the INSERT privilege should be enough.

@envirosolutionspl envirosolutionspl added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jan 9, 2021
@gioman gioman changed the title Disabled attribute form when inserting feature with postgres insert privilage Cannot save edits on PostGIS table when user has only the INSERT privilige Jan 10, 2021
@gioman
Copy link
Contributor

gioman commented Jan 10, 2021

@envirosolutionspl I extensively edited your title and description to make the problem clearer.

@gioman gioman changed the title Cannot save edits on PostGIS table when user has only the INSERT privilige Cannot enter attributes and save edits on PostGIS table when user has only the INSERT privilige Jan 10, 2021
@elpaso elpaso self-assigned this Jan 18, 2021
elpaso added a commit to elpaso/QGIS that referenced this issue Jan 18, 2021
nyalldawson pushed a commit that referenced this issue Jan 18, 2021
@envirosolutionspl
Copy link
Author

Good job guys, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! PostGIS data provider
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants