Skip to content

Commit 6649738

Browse files
committed
Prefix joined field with layer name to make conflict between attributes with the same name less likely
1 parent 3f4df9f commit 6649738

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/core/qgsvectorlayerjoinbuffer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ void QgsVectorLayerJoinBuffer::updateFieldMap( QgsFieldMap& fields, int& maxInde
9999
//skip the join field to avoid double field names (fields often have the same name)
100100
if ( fieldIt.key() != joinIt->joinField )
101101
{
102-
fields.insert( maxIndex + 1 + fieldIt.key(), fieldIt.value() );
102+
QgsField f = fieldIt.value();
103+
f.setName( joinLayer->name() + "_" + f.name() );
104+
fields.insert( maxIndex + 1 + fieldIt.key(), f );
103105
}
104106
}
105107

0 commit comments

Comments
 (0)