Bug report #13032

Save as... fails to populate fields if layer has similar names only different by case

Added by Alexandre Neto almost 9 years ago. Updated over 8 years ago.

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

Description

When using "save as..." in a layer, the tool fails to fill all fields values correctly if there are columns with similar names (being CAPS the only difference; I know it's a bad policy to give similar names to columns, but... it's out of my reach)

QGIS will consider that the columns have the same name, and therefore will create a new column with a suffix (fieldname_1). So far so good. But then fails to populate the new column with values.

I have marked that it causes corruption since the output will not be what the user expects.

I believe that issue #13027 is also related. Have something to do with the QgsVectorFileWriter.

To replicate the problem one can create a memory layer and add two columns named 'fieldname' and 'FieldName', and add some features. Notice that the feature form won't work well and will fill both fields at the same time. Edit them in the attribute table. Save. Use Save as... to make the layer permanent.


Related issues

Related to QGIS Application - Bug report #13027: Join by location does not work when layers have equivalen... Closed 2015-06-22

Associated revisions

Revision 8e2b7910
Added by Jürgen Fischer over 8 years ago

case-sensitivity of vector layer field (fixes #13032)
  • fieldNameIndex: resort to case-insensitive lookup only if
    case-sensitive lookup has no match
  • file writer: fix handling of fields that only differ by case

Revision 945187c8
Added by Jürgen Fischer over 8 years ago

case-sensitivity of vector layer field (fixes #13032)
  • fieldNameIndex: resort to case-insensitive lookup only if
    case-sensitive lookup has no match
  • file writer: fix handling of fields that only differ by case

(backported from commit 8e2b791)

History

#1 Updated by Giovanni Manghi almost 9 years ago

  • Target version set to Future Release - High Priority
  • Priority changed from Normal to High
  • Category changed from Attribute table to Vectors

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

  • Subject changed from Save as... failed to populate fields if layer as similar names (with caps) to Save as... fails to populate fields if layer has similar names only different by case

#3 Updated by Jürgen Fischer over 8 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF