File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -1462,20 +1462,22 @@ bool QgsPostgresProvider::determinePrimaryKey()
1462
1462
{
1463
1463
QString name = res.PQgetvalue ( i, 0 );
1464
1464
1465
- int idx = mAttributeFields .key ( name, -1 );
1465
+ QgsFieldMap::const_iterator it = mAttributeFields .begin ();
1466
+ while ( it != mAttributeFields .end () && it->name () != name )
1467
+ it++;
1466
1468
1467
- if ( idx < 0 )
1469
+ if ( it == mAttributeFields . end () )
1468
1470
{
1469
1471
QgsDebugMsg ( " Skipping " + name );
1470
1472
continue ;
1471
1473
}
1472
1474
1473
1475
if ( isInt &&
1474
- mAttributeFields [idx]. type () != QVariant::Int &&
1475
- mAttributeFields [idx]. type () != QVariant::LongLong )
1476
+ it-> type () != QVariant::Int &&
1477
+ it-> type () != QVariant::LongLong )
1476
1478
isInt = false ;
1477
1479
1478
- mPrimaryKeyAttrs << idx ;
1480
+ mPrimaryKeyAttrs << it. key () ;
1479
1481
}
1480
1482
1481
1483
mPrimaryKeyType = ( mPrimaryKeyAttrs .size () == 1 && isInt ) ? pktInt : pktFidMap;
You can’t perform that action at this time.
0 commit comments