6

I have a PostgreSQL database which is accessed by multiple users and each user have different levels of privileges on tables and views. To insert/update/delete features, the users have to work on QGIS.

Let's get to the problem.

I have created a view on MultiLineString data. When i use basic editing tools like add feature, node tool, delete tool and move feature, everything works fine and the edits save successfully. But when i use advance editing tools like split feature, merge features it gives me strange behavior. When i split a linestring and save the edits, one of the splitted segments disappear. when i merge two segments and save edits, the merged segment disappears.

I tested the advance editing tools i.e. split and merge, on the table from which the above view is created and everything works fine, i am able to save merged and splitted features.

Version: PostgreSQL 9.5 and QGIS 2.18.2

1 Answer 1

4

One approach to this problem could be that you can implement Row Level Security on your table based on the users and your own criteria. From your problem it seems that on splitting and merging new geometry would be obtained by the QGIS, and it is unable to insert back that geometry because you are fetching data from view. Using Row Level security, you would also be able to avoid the view creation step that seems to be un-necessary.

You can also get guide about Row level policy on table for PostgreSQL from https://www.postgresql.org/docs/9.5/static/ddl-rowsecurity.html

3
  • Wouldn't the Insert also fail (OP said it works)?
    – JGH
    Jul 10, 2017 at 14:20
  • but you can use default value if it is user based to current_user, or some trigger for custom function. Jul 11, 2017 at 9:10
  • i am accepting this as a best alternate answer, but i am still interested in the solution for the above problem, using views. Jul 11, 2017 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.