Skip to content
Permalink
Browse files

[postgresraster] Fix invalid comparison of string to int

  • Loading branch information
nyalldawson committed Mar 30, 2021
1 parent 71fd493 commit 3e79a68d5829f7cf988f8b4f781075804a3add0a
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/providers/postgres/raster/qgspostgresrasterprovider.cpp
@@ -1874,9 +1874,9 @@ bool QgsPostgresRasterProvider::loadFields()
QgsField newField = QgsField( fieldName, fieldType, fieldTypeName, fieldSize, fieldPrec, fieldComment, fieldSubType );

QgsFieldConstraints constraints;
if ( notNullMap[tableoid][attnum] || ( mPrimaryKeyAttrs.size() == 1 && mPrimaryKeyAttrs[0] == i ) || identityMap[tableoid][attnum] != ' ' )
if ( notNullMap[tableoid][attnum] || ( mPrimaryKeyAttrs.size() == 1 && mPrimaryKeyAttrs[0] == fieldName ) || identityMap[tableoid][attnum] != ' ' )
constraints.setConstraint( QgsFieldConstraints::ConstraintNotNull, QgsFieldConstraints::ConstraintOriginProvider );
if ( uniqueMap[tableoid][attnum] || ( mPrimaryKeyAttrs.size() == 1 && mPrimaryKeyAttrs[0] == i ) || identityMap[tableoid][attnum] != ' ' )
if ( uniqueMap[tableoid][attnum] || ( mPrimaryKeyAttrs.size() == 1 && mPrimaryKeyAttrs[0] == fieldName ) || identityMap[tableoid][attnum] != ' ' )
constraints.setConstraint( QgsFieldConstraints::ConstraintUnique, QgsFieldConstraints::ConstraintOriginProvider );
newField.setConstraints( constraints );

@@ -2210,7 +2210,7 @@ QString QgsPostgresRasterProvider::pkSql()
if ( mPrimaryKeyAttrs.count( ) > 1 )
{
QStringList pkeys;
for ( const auto &k : std::as_const( mPrimaryKeyAttrs ) )
for ( const QString &k : std::as_const( mPrimaryKeyAttrs ) )
{
pkeys.push_back( quotedIdentifier( k ) );
}

0 comments on commit 3e79a68

Please sign in to comment.