I am working on python plugins for QGIS.I developed the plugins same as RT SQL LAYER plugins.

When we draw the layers using query builder of "Add Postgis Layer" option,toggle editing option is available for the same.

But when i try to draw layers using RT SQL LAYER plugin ,it is not available for editing. Same happens with my plugins too.

How do I make toggle editing option available for my plugins.?? My plugins are in python.


The query builder just sets a subset string via QgsVectorLayer::setSubsetString() on the layer (also changeable later in the layer properties or via "Query" in the layer context menu).

In the postgres provider case this can be an arbitrary complex where clause and the layer remains editable.

RT layer however creates an layer from an arbitrary complex query, which is not updateable and therefore can't be edited.


In RT SQL Layer, it is possible to define queries that change the data (e.g. apply a buffer to points) in a way that it wouldn't be feasible to allow editing on the layer. (What should happen if the buffers are manipulated? That cannot be written back to PostGIS.)

Whether a layer is editable or not depends on its data provider and the methods it implements.

  • ok...which data provider can be use to make layer editable?? Thanx in advance:) – PNM May 24 '12 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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