Bug report #13032
Save as... fails to populate fields if layer has similar names only different by case
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
Associated revisions
- 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
- 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 over 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 about 9 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 about 9 years ago
- Status changed from Open to Closed
Fixed in changeset 8e2b791092ebc2be415c24c76bdc9d1b5a149961.