File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -5742,11 +5742,9 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )
5742
5742
for ( int idx = 0 ; idx < fields.count (); ++idx )
5743
5743
{
5744
5744
int dst = pasteVectorLayer->fieldNameIndex ( fields[idx].name () );
5745
- if ( dst < 0 || pkAttrList.contains ( dst ) )
5746
- {
5747
- // skip primary key attributes
5745
+ if ( dst < 0 )
5748
5746
continue ;
5749
- }
5747
+
5750
5748
remap.insert ( idx, dst );
5751
5749
}
5752
5750
@@ -5763,6 +5761,14 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )
5763
5761
if ( dst < 0 )
5764
5762
continue ;
5765
5763
5764
+ // use default value for primary key fields if it's NOT NULL
5765
+ if ( pkAttrList.contains ( dst ) )
5766
+ {
5767
+ dstAttr[ dst ] = pasteVectorLayer->dataProvider ()->defaultValue ( dst );
5768
+ if ( !dstAttr[ dst ].isNull () )
5769
+ continue ;
5770
+ }
5771
+
5766
5772
dstAttr[ dst ] = srcAttr[ src ];
5767
5773
}
5768
5774
You can’t perform that action at this time.
0 commit comments