Skip to content

Commit

Permalink
postgres provider: fix adding features with null values (fixes #11777)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jan 16, 2015
1 parent ba4948e commit 03713ce
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -1615,9 +1615,6 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
for ( int idx = 0; idx < attributevec.count(); ++idx )
{
QVariant v = attributevec[idx];
if ( !v.isValid() )
continue;

if ( fieldId.contains( idx ) )
continue;

Expand All @@ -1638,9 +1635,6 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
const QgsAttributes &attrs2 = flist[i].attributes();
QVariant v2 = attrs2[idx];

if ( !v2.isValid() )
break;

if ( v2 != v )
break;
}
Expand Down Expand Up @@ -1731,7 +1725,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
QVariant value = attrs[ fieldId[i] ];

QString v;
if ( !value.isValid() )
if ( value.isNull() )
{
const QgsField &fld = field( fieldId[i] );
v = paramValue( defaultValues[i], defaultValues[i] );
Expand Down

0 comments on commit 03713ce

Please sign in to comment.