Feature request #9689

Joins should be more mindful of DBF field name length limitations

Added by Emilio G about 3 years ago. Updated 10 months ago.

Status:Closed Start Date:03/02/2014
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:Vectors
Target version:Future Release - Nice to have
Platform: Resolution:fixed/implemented
Platform version: Pull Request or Patch supplied:No
Status info: Tag:

Description

When performing a "join" between a DBF file and a shape file, QGIS will prepend the field names with the name of the DBF layer name followed by an underscore.

Surprisingly, layers can have blank names, so that saves some characters. But I still get every field prepended with an underscore.

The table manager plugin will not let you edit field names for those fields that have just been joined; the shape file must be saved and reopened at which point all names have been cropped to the (11?) character limit.

History

Updated by Giovanni Manghi about 3 years ago

  • Category set to Vectors
  • Target version changed from Version 2.2 to Future Release - Nice to have
  • Platform deleted (Windows 7 x64)

Not an easy task, the prefix is necessary to avoid attributes with the same name, then shapefiles have a 10 chars column name limit. Of course the vector with the joined table can be exported to a more advanced format, like spatialite or postgis where such limitation does not exist.

How do you suggest to solve the issue with shapefiles?

Updated by Emilio G about 3 years ago

The software should simply check if the name is a duplicate. If not, leave it as is. It cannot simply prepend the layer name and hope that this is not a duplicate, so it must be doing some level of checking now, no?

Updated by J├╝rgen Fischer about 3 years ago

Emilio G wrote:

The software should simply check if the name is a duplicate. If not, leave it as is. It cannot simply prepend the layer name and hope that this is not a duplicate, so it must be doing some level of checking now, no?

It doesn't. There is no restriction before you decide that you want to save the data in a shapefile. And the mapping of arbitrary field names to attributes in shapefiles handled (although it's not as nice as going without a prefix, if that's not necessary for unique field names).

Not sure, if it isn't a bug in the table manager plugin, that it shows joined fields on a shapefile. I believe it wouldn't work with those, even if the names were 11 characters or less.

Updated by Giovanni Manghi about 3 years ago

  • Status changed from Open to Feedback

Emilio G wrote:

The software should simply check if the name is a duplicate. If not, leave it as is. It cannot simply prepend the layer name and hope that this is not a duplicate, so it must be doing some level of checking now, no?

how other software does?

Updated by Antonio Locandro almost 3 years ago

When you open the attribute table it shows the join fields as they are unless duplicate I believe it adds a _1 or something to distinguish

Now when doing a Query it adds the layer name + "." + Field to be able to make a difference of one to another

This helps when you save a layer with a join, since the attribute table have the same column names as the join fields if possible

Updated by Nyall Dawson 10 months ago

  • Status changed from Feedback to Closed
  • Resolution set to fixed/implemented

QGIS supports custom prefixes for joined layers, so this should be fixed now

Also available in: Atom