I want to know if QGIS locks the row of a postgis table for editing or can this behavior be force implemented? Suppose there is another user who wants to edit the same row-- this must not be allowed.
1 Answer
I did a quick test (qgis 3.10 / postgresql 12 / postgis 3)
If I am opening a table for editing in qgis, I have no problem editing the same row from a psql prompt. It seems to me that the only locking that is going on is at the moment the row is stored.
So - I can open the attribute table for the layer "sns" in qgis and set comment to 'something' for the feature with id=1, at the same time I can do
update sns set comment = 'something else' where id =1;
in pgsql, and whatever is saved the last will stay in the database.
To a certain degree, this makes sense, as each of the updates are just taking place at the client level until the update is stored, but on the other side, in certain cases, it should be possible to lock against updates from other clients when a table is being edited in qgis, but that probably will be easiest to implement as table level locks (I was not able to see anything about locking when doing a quick look at the qgis postgis connection dialog)
There has actually been a feature request for this: