I stumbled upon an odd behaviour of layers in QGIS 3.4 brought from PostGIS. The first layers I brought to the project are always editable together when clicking the Toggle Edit-button, but some of the other layers are editable only when separately selected. These layers have been brought to the project afterwards. I have tested this in 3.4.0 and 3.4.2. with Windows (as QGS and QGZ). Also when the same project was used by others in their own environment, all the layers had to be separately changed to editable. This causes problems because there are relations between the tables and you have to know what tables should be editable. How can I make all the layers editable at once?

Edit: Noticed that when the same layers are brought to a new project, they have to be clicked editable one at a time. I have used Project Generator tool to create the layers and some of the relations between the layers.

Here an example of the problem

  • 1
    Welcome to GIS.SE! Are the layers brought afterwards from the same PostGIS DB? If so, did you try to check Automatically create transaction groups where possible under Project > Project Properties > Data Sources ? Dec 12, 2018 at 10:15
  • Yes, the layers are from the same database but the first ones were brought with QGIS Project Generator tool (that also brought the relations) the other layers were brought afterwards through normal add layer method. The transaction groups is by default checked. The most bizarre thing is that the same project (qgs) behaves differently in other setup with our client. But we'll have to check if they have that button checked. Dec 12, 2018 at 13:37
  • Our client has the transaction groups checked, but the layers are still not editable at once. Starting to think this is due some PostGIS connections / user rights. In my case the layers think that they are coming from different places (because of the tool I have used). I tested by adding some layers through Project Generator tool and some layers from Add layers > Add PostGIS layers and they don't "group" with each other. So, do you know @jochen or somebody else, can you do something else in QGIS project to force QGIS to see the wanted transaction groups? Dec 13, 2018 at 8:04
  • And the result was that our clients difference in the project was due to database user rights. When the user rights were given to the database (not separate schemas), everything went well. The reason why my project does not understand the connections between the layers was probably the use of Project Generator tool. I can fetch the ill behaving layers from there if I need to, so thank you all for the suggestions! Dec 13, 2018 at 12:52

2 Answers 2


What @jochen-schwarze suggested, should work but if needed, you can put all vector layers that have been opened in the project to edit mode with the following code in QGIS 3:

layers = QgsProject.instance().mapLayers()
for layer in layers.values():
    if isinstance(layer, QgsVectorLayer) and not layer.isEditable():
  • 1
    Thank you @orienteerix :) I think we have a workaround for this now. But still a bit baffled how to get some of the layers to the transactiongroup suggested by Jochen. But we can do this now! Thank you all! Dec 12, 2018 at 14:50

There is a chunk of code here - Set layer in edit mode in QGIS processing that may help. You can either put that in the Plugins/Python Counsel (Ctrl+Alt+P) or possibly write a small plugin with a button that launches this.

Click on the little "Show Editor" button paste your code and save it. Then run it with the green run button.

enter image description here

I am not sure if there is a plug-in for that specifically but you could look at the Digitizing Tools Plug-in and see if you can select more than one layer and set those to Edit.

  • Thank you @caryhutchinson, we shall see if there is some help on this and report here (I have not used Python console my self, but my colleague can help)! Dec 12, 2018 at 14:01

Your Answer

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

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