Skip to content

Commit 265c253

Browse files
committed
Fix primary key search
1 parent cfe397e commit 265c253

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2979,7 +2979,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer(
29792979
{
29802980
// it already exists, try again with a new name
29812981
primaryKey = QString( "%1_%2" ).arg( pk ).arg( index++ );
2982-
fldIdx = 0;
2982+
fldIdx = -1; // it is incremented in the for loop, i.e. restarts at 0
29832983
}
29842984
}
29852985
}

src/providers/spatialite/qgsspatialiteprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ QgsSpatiaLiteProvider::createEmptyLayer(
157157
{
158158
// it already exists, try again with a new name
159159
primaryKey = QString( "%1_%2" ).arg( pk ).arg( index++ );
160-
fldIdx = 0;
160+
fldIdx = -1; // it is incremented in the for loop, i.e. restarts at 0
161161
}
162162
}
163163
}

0 commit comments

Comments
 (0)