Skip to content

Commit f528d2b

Browse files
manisandrojef-n
authored andcommittedApr 26, 2015
Fix primary key search
(cherry picked from commit 265c253)
1 parent 1a827ab commit f528d2b

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
@@ -2968,7 +2968,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer(
29682968
{
29692969
// it already exists, try again with a new name
29702970
primaryKey = QString( "%1_%2" ).arg( pk ).arg( index++ );
2971-
fldIdx = 0;
2971+
fldIdx = -1; // it is incremented in the for loop, i.e. restarts at 0
29722972
}
29732973
}
29742974
}

‎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)
Please sign in to comment.