Skip to content
Permalink
Browse files

the test for uniqueness now also works for multiple columns

  • Loading branch information
SebDieBln authored and jef-n committed Oct 17, 2015
1 parent a4124da commit ab943f8b06fb628f9b1eb8776d12686f824d0157
Showing with 7 additions and 7 deletions.
  1. +4 −4 src/providers/postgres/qgspostgresprovider.cpp
  2. +3 −3 src/providers/postgres/qgspostgresprovider.h
@@ -1314,12 +1314,12 @@ void QgsPostgresProvider::determinePrimaryKeyFromUriKeyColumn()
}
}

bool QgsPostgresProvider::uniqueData( QString query, QString quotedColName )
bool QgsPostgresProvider::uniqueData( QString query, QString quotedColNames )
{
Q_UNUSED( query );
// Check to see if the given column contains unique data
QString sql = QString( "SELECT count(distinct %1)=count(%1) FROM %2%3" )
.arg( quotedColName,
// Check to see if the given columns contain unique data
QString sql = QString( "SELECT count(distinct (%1))=count((%1)) AND bool_and((%1) IS NOT NULL) FROM %2%3" )
.arg( quotedColNames,
mQuery,
filterWhereClause() );

@@ -456,9 +456,9 @@ class QgsPostgresProvider : public QgsVectorDataProvider
QString mWhat;
};

// A function that determines if the given schema.table.column
// contains unqiue entries
bool uniqueData( QString query, QString colName );
// A function that determines if the given columns
// contain unique entries
bool uniqueData( QString query, QString quotedColNames );

int mEnabledCapabilities;

0 comments on commit ab943f8

Please sign in to comment.
You can’t perform that action at this time.