Feature request #13036

Improve handling of homonymous field names in table joins

Added by Konstantin Greger over 9 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Vectors
Pull Request or Patch supplied:No Resolution:not reproducable
Easy fix?:No Copied to github as #:21111

Description

When joinig two tables that contain fields wit identical names (apart from the field used for the join) the handling of the joined fields is messed up in QGIS: while the field names are handled correctly the field contents is shifted one column to the right, filling the newly created field with <NULL> values and trimming the right-most/last field completely.

Steps to reproduce:
1. Open table a
2. Open table b, which contains at least one field with a field name that exists in table a as well
3. Join the tables in the table a’s "Properties" dialog

More details and screenshots showing the erroneous behavior can be found here http://www.konstantingreger.net/annoying-join-behavior-in-qgis/

As I point out in my blog post the problem can be overcome by either renaming the field names before the join or by using the "Add vector join" properties dialog's "custom field name prefix" option.

My suggestion would be to include a routine in the join process that checks for homonymous column names and adds a counter to the field names to distinguish the fields (e.g. pop_tot and pop_tot would become pop_tot and pop_tot1 etc.)

I tried this on QGIS 2.8.1-Wien (64bit) on a Windows 7 machine.

History

#1 Updated by Konstantin Greger over 9 years ago

This issue might be related to #10244 (can't verify since no sample data was provided)
Also, #3633 suggested something similar

#2 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Open to Feedback
  • Category set to Vectors

please try qgis master and report back. Thanks.

#3 Updated by Nyall Dawson over 8 years ago

  • Resolution set to not reproducable
  • Status changed from Feedback to Closed

Closing due to lack of feedback

Also available in: Atom PDF