Bug report #9221

Overwriting shapefile removes all attribute data and features

Added by Gillian Thornhill over 6 years ago. Updated over 6 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:Vectors
Affected QGIS version:2.0.1 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:17842

Description

Using the 'save as' dialog to overwrite a shape file writes a new empty shape file, losing all the previous data in the shape file.
Steps to reproduce:
Create a new vector layer from the 'Layer: new' dialog, select 'New shape file layer'
Edit this layer, (I just set it editable, added some random points, saved changes when prompted when I turned off edit mode)
Select 'Save as' from the 'Layer' menu, leave options as defaults, Format 'ESRI Shapefile'; navigate to original file name, select in file browser.
Select 'Replace' in dialog.
Delete layer from QGIS.
Go to 'Add layer', select the shape file you just saved
Import it.
All the data has disappeared, including the attribute table.

I'm pretty sure this didn't happen in 1.8.
Also, if you skip the 'Save as' step, and delete the layer then re-import it, the data is fine.
It's the step of using 'Save as' and overwriting it that delete all the data.

Running on MacOS 10.7.5

Version info:
QGIS version 2.0.1-Dufour QGIS code revision f738351
Compiled against Qt 4.8.5 Running against Qt 4.8.5
Compiled against GDAL/OGR 1.10.1 Running against GDAL/OGR 1.10.1
Compiled against GEOS 3.4.2-CAPI-1.8.2 Running against GEOS 3.4.2-CAPI-1.8.2 r3921
PostgreSQL Client Version 9.2.4 SpatiaLite Version 4.1.1
QWT Version 6.0.2 PROJ.4 Version 480
QScintilla2 Version

Associated revisions

Revision d59ab805
Added by Jürgen Fischer over 6 years ago

avoid saving OGR layer to the very same OGR layer (fixes #9221)

History

#1 Updated by Salvatore Larosa over 6 years ago

  • OS version deleted (10.7.5)
  • Operating System deleted (Mac)
  • Priority changed from High to Severe/Regression

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

  • Status changed from Open to Closed

Also available in: Atom PDF