Skip to content
Permalink
Browse files

Fix adding features with "evaluate default values"

  • Loading branch information
m-kuhn committed Oct 26, 2016
1 parent 31fc48f commit 637c6d33b3a98310149eb0c330756f5e82f39dc8
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/providers/postgres/qgspostgresprovider.cpp
@@ -2049,12 +2049,19 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
if ( value.isNull() )
{
const QgsField &fld = field( attrIdx );
v = paramValue( defaultValues[ i ], defaultValues[ i ] );
if ( providerProperty( EvaluateDefaultValues, false ).toBool() )
v = defaultValues[ i ];
else
v = paramValue( defaultValues[ i ], defaultValues[ i ] );

features->setAttribute( attrIdx, convertValue( fld.type(), v ) );
}
else
{
v = paramValue( value.toString(), defaultValues[ i ] );
if ( providerProperty( EvaluateDefaultValues, false ).toBool() )
v = value.toString();
else
v = paramValue( value.toString(), defaultValues[ i ] );

if ( v != value.toString() )
{

2 comments on commit 637c6d3

@3nids

This comment has been minimized.

Copy link
Member

@3nids 3nids replied Oct 26, 2016

thanks a lot!
cherry-pick to master?

@m-kuhn

This comment has been minimized.

Copy link
Member Author

@m-kuhn m-kuhn replied Oct 26, 2016

I guess so, let me know after your demo ;)

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