Feature request #13036
Improve handling of homonymous field names in table joins
|Pull Request or Patch supplied:
|Copied to github as #:
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.