Bug report #18421

Attribute Table refresh issue when deleting features from shapefile

Added by Geo Dev about 6 years ago. Updated about 5 years ago.

Status:Closed
Priority:High
Assignee:Julien Cabieces
Category:Attribute table
Affected QGIS version:3.5(master) Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:26310

Description

When features are deleted from shapefile, in the Attribute Table not only the corresponding rows are removed but also other rows temporarily disappear.

Step to replicate the issue:
- create a new shapefile (the issue doesn't occur with other data formats)
- start editing and add two features: the first one with id=1 and the second one with id=2 (the insertion order is important)
- save editing (without this step the issue doesn't occur)
- open the Attribute Table
- select and delete the first inserted feature: the row with id=1 disappears as expected
- save editing: unexpectedly also the other row with id=2 disappears
- close and reopen the Attribute Table: the row with id=2 reappears

In general the issue occurs deleting features that have other features inserted after them.
The issue is OS independent, it occurs both in QGIS 2.14.21 and QGIS 2.18.17 but it doesn't occur in QGIS 2.8.9 (regression) and QGIS 3.0.0.

Associated revisions

Revision 627230c1
Added by Julien Cabieces about 5 years ago

fixes #18421 : Keep options AUTO_REPACK=OFF when reloading data in ogr provider

Revision b30f51ab
Added by Julien Cabieces about 5 years ago

fixes #18421 : Keep options AUTO_REPACK=OFF when reloading data in ogr provider

History

#1 Updated by Geo Dev about 6 years ago

More useful details using any shapefile:
deleting the first N features and saving the editing, in the attribute table exactly 2*N rows disappear.
N rows are correctly the features selected but the other N rows should not disappear.

#2 Updated by Geo Dev almost 6 years ago

The issue still occurs in the last LTR.
The affected QGIS version can be updated to 2.18.20.

#3 Updated by Geo Dev over 5 years ago

The issue still occurs in QGIS 2.18.25.
It's a misleading issue since the user has the perception that more features than expected are deleted.

#4 Updated by Giovanni Manghi over 5 years ago

  • Affected QGIS version changed from 2.18.17 to 2.18.24

#5 Updated by Jürgen Fischer over 5 years ago

  • Status changed from Open to Feedback

Please test with QGIS 3.4 - QGIS 2.18 reached it's end of life.

#6 Updated by Geo Dev about 5 years ago

  • Status changed from Feedback to Open

The issue also occurs with QGIS 3.4.4 and QGIS 3.5(master) but with a different behavior.

Now the following error appears:

Commit errors: Could not commit changes to layer <layername>
Errors: ERROR: 1 feature(s) not deleted.
Provider errors:
OGR error deleting feature 1:

The steps to replicate the issue with QGIS 3.4.4 and QGIS 3.5(master) are slightly different:

- create a new shapefile (the issue doesn't occur with other data formats)
- start editing and add two features: the first one with id=1 and the second one with id=2 (the insertion order is important)
- save editing (without this step the issue doesn't occur)
- open the Attribute Table
- if the Attribute Table is not opened as docked window, dock it clicking on the button "Dock Attribute Table"
- select and delete the first feature inserted with id=1
- save editing
- select and delete the second feature inserted with id=2
- save editing: the OGR error appears

The issue doesn't occur if the Attribute Table is not docked or it's already open when the first "save editing" is done (third step).

#7 Updated by Giovanni Manghi about 5 years ago

  • Affected QGIS version changed from 2.18.24 to 3.5(master)

#8 Updated by Julien Cabieces about 5 years ago

  • Assignee set to Julien Cabieces

#9 Updated by Julien Cabieces about 5 years ago

  • Pull Request or Patch supplied changed from No to Yes

#10 Updated by Julien Cabieces about 5 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF