Bug report #17124

Editing behavior of filtered layers is inconsistent

Added by Giovanni Manghi over 7 years ago. Updated about 6 years ago.

Status:Open
Priority:High
Assignee:-
Category:Vectors
Affected QGIS version:3.2.2 Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:25023

Description

Seen on 2.14, 2.18 and master.

Add a shapefile
Set a filter > vector continues editable
Save project, close project and reopen it > layer is not editable
Clear filter > still not editable
Save project, close project and reopen it > layer editable


Related issues

Related to QGIS Application - Bug report #17245: "orig_ogc_fid" field is added to filtered shapefiles in Q... Feedback 2017-10-04
Related to QGIS Application - Bug report #19699: Removing Filter on shape file layer does not restore read... Closed 2018-08-26
Duplicated by QGIS Application - Bug report #17193: Editing of shapefile locked following clearing of a filter Closed 2017-09-25

History

#1 Updated by Jürgen Fischer about 7 years ago

  • Duplicated by Bug report #17193: Editing of shapefile locked following clearing of a filter added

#2 Updated by Jürgen Fischer about 7 years ago

  • Subject changed from Editing behaviur of filtered layers is inconsistent to Editing behavior of filtered layers is inconsistent

#3 Updated by Jürgen Fischer about 7 years ago

  • Related to Bug report #17245: "orig_ogc_fid" field is added to filtered shapefiles in QGIS master added

#4 Updated by Patrick Dunford about 7 years ago

This is a big deal for me, because when I have to close the project just so I can edit a table that I had a filter applied to (after removing the filter) and then reopen the project again.

However I think there is a whole question here of why editing a filtered table is blocked. In my maps which are used to show generations of historical data, there can be overlapping features that you want to hide to be able to draw in different generation ones. At the moment I have to create them in a separate table then paste them. Now imagine that I need to edit, then having to make another copy of the data to make changes to it, and then paste back.

Here is a need for a paradigm shift for working with a filtered table. When a filter is created on a layer, the GUI should create a temporary copy of the table, apply the filter to it and use that copy for the displaying of data. But allowing the user to edit the real table. Or something like that.

#5 Updated by Giovanni Manghi almost 7 years ago

  • Regression? changed from No to Yes
  • Priority changed from Normal to High
  • Affected QGIS version changed from 2.18.12 to 2.18.16

#6 Updated by Patrick Dunford almost 7 years ago

I'm curious about all this because in 2.14 I can follow these steps
  • Put a filter onto a table
  • Put the table into edit mode
  • Add a new feature or change an existing one
  • Save the layer
  • Take the layer out of edit mode
  • Remove the filter
    without apparently any repercussions.

The layer type is a shapefile.

In view of the additional restrictions being applied in 2.18 and later maybe there are some questions that could be answered in another forum? Maybe they already have.
  1. What is the technical reason for the limitation being desirable
  2. Is there a technical reason for the change being necessary after 2.14 but not an issue in 2.14
  3. Is there a different file based layer type that does not require these limitations.

TIA

#7 Updated by Giovanni Manghi almost 7 years ago

  • Affected QGIS version changed from 2.18.16 to 2.18.17
  • Status changed from Open to Feedback

The layer type is a shapefile.

In view of the additional restrictions being applied in 2.18 and later maybe there are some questions that could be answered in another forum? Maybe they already have.
  1. What is the technical reason for the limitation being desirable
  2. Is there a technical reason for the change being necessary after 2.14 but not an issue in 2.14
  3. Is there a different file based layer type that does not require these limitations.

you have a better chance to have answers if you post your doubts in the users/developers mailing lists.

Anyway, the "normal" behavior is/was that filtered shapefiles/gpkgs/spatialite are not editable. This has always been the case in QGIS and as far I can see now is also the case on 2.18.16 and QGIS 3. Of course the fact that is possible to edit a filtered shapefiles/gpkgs/spatialite in QGIS 2.14(.22) raises questions.

This ticket can probably be closed as now the behavior is consistent (but the above question is of course very interesting).

#8 Updated by Antonio Viscomi almost 7 years ago

Patrick Dunford wrote:

I'm curious about all this because in 2.14 I can follow these steps
  • Put a filter onto a table
  • Put the table into edit mode
  • Add a new feature or change an existing one
  • Save the layer
  • Take the layer out of edit mode
  • Remove the filter
    without apparently any repercussions.

Hi,
the filter I applied wasn in Properties --> query builder (not in attribute table) because I need to see only filtered records on the canvas;
the filter applied on attribute table works fine but don't filter the shapefile in the canvas then the issues is a little bit different...

The layer type is a shapefile.

In view of the additional restrictions being applied in 2.18 and later maybe there are some questions that could be answered in another forum? Maybe they already have.
  1. What is the technical reason for the limitation being desirable
  2. Is there a technical reason for the change being necessary after 2.14 but not an issue in 2.14
  3. Is there a different file based layer type that does not require these limitations.

TIA

#9 Updated by Giovanni Manghi almost 7 years ago

Hi,
the filter I applied wasn in Properties --> query builder (not in attribute table) because I need to see only filtered records on the canvas;
the filter applied on attribute table don't works fine but don't filter the shapefile in the canvas then the issues is a little bit different...

I'm not sure I understand the above.
The filter in vector properties > query builder effectively will show you only filter records and features. The second part is not clear at all. I'm also not sure if the comment fits the issue described in this ticket.

#10 Updated by Antonio Viscomi almost 7 years ago

Giovanni Manghi wrote:

Hi,
the filter I applied wasn in Properties --> query builder (not in attribute table) because I need to see only filtered records on the canvas;
the filter applied on attribute table works fine but don't filter the shapefile in the canvas then the issues is a little bit different...

I'm not sure I understand the above.
The filter in vector properties > query builder effectively will show you only filter records and features. The second part is not clear at all. I'm also not sure if the comment fits the issue described in this ticket.

The second part is referred only to the steps described in the first post by
Patrick Dunford, because It applied a filter onto attribute table, not on layers proprierties...

#11 Updated by Giovanni Manghi almost 7 years ago

  • Status changed from Feedback to Open

The second part is referred only to the steps described in the first post by
Patrick Dunford, because It applied a filter onto attribute table, not on layers proprierties...

I still don't understand how this is related to the original description of this issue.

#12 Updated by Arjan Mossel almost 7 years ago

Giovanni Manghi wrote:

I still don't understand how this is related to the original description of this issue.

I think I do. You said "This ticket can probably be closed as now the behavior is consistent", but it would be very useful for the behavior to be consistent the other way, with filtered layers always editable.

Because now it is not possible to have a filtered layer on the canvas and be able to edit its attributes. This is also what I'm looking for.

Edit: found #13292 for this.

#13 Updated by Giovanni Manghi over 6 years ago

  • Affected QGIS version changed from 2.18.17 to 3.2.2

See also #19699

#14 Updated by Jürgen Fischer over 6 years ago

  • Related to Bug report #19699: Removing Filter on shape file layer does not restore read-write permissions - editing refused until reload added

#15 Updated by Antonio Viscomi about 6 years ago

In fact any change in snap tolerance setting don't solve the issues

#16 Updated by Giovanni Manghi about 6 years ago

Antonio Viscomi wrote:

In fact any change in snap tolerance setting don't solve the issues

this ticket isn't related at all to snapping.

Also available in: Atom PDF