Skip to content

Commit 634641a

Browse files
committed
Merge pull request #1993 from manisandro/fldidx
Fix primary key search uniqueness Duplicate suffix `_0` has not been detected previously
2 parents d78bc7d + 265c253 commit 634641a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/providers/postgres/qgspostgresprovider.cpp

+1-1
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

+1-1
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)