From 265c253995ae755194df514a07ecaad35fd3ec57 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Tue, 14 Apr 2015 17:02:44 +0200 Subject: [PATCH] Fix primary key search --- src/providers/postgres/qgspostgresprovider.cpp | 2 +- src/providers/spatialite/qgsspatialiteprovider.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index c348c2929b4..81fcc6c9a5a 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -2979,7 +2979,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer( { // it already exists, try again with a new name primaryKey = QString( "%1_%2" ).arg( pk ).arg( index++ ); - fldIdx = 0; + fldIdx = -1; // it is incremented in the for loop, i.e. restarts at 0 } } } diff --git a/src/providers/spatialite/qgsspatialiteprovider.cpp b/src/providers/spatialite/qgsspatialiteprovider.cpp index 222a86a4130..48271ec8a58 100644 --- a/src/providers/spatialite/qgsspatialiteprovider.cpp +++ b/src/providers/spatialite/qgsspatialiteprovider.cpp @@ -157,7 +157,7 @@ QgsSpatiaLiteProvider::createEmptyLayer( { // it already exists, try again with a new name primaryKey = QString( "%1_%2" ).arg( pk ).arg( index++ ); - fldIdx = 0; + fldIdx = -1; // it is incremented in the for loop, i.e. restarts at 0 } } }