@@ -2084,15 +2084,18 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist, Flags flags )
2084
2084
2085
2085
insert += values + ' )' ;
2086
2086
2087
- if ( mPrimaryKeyType == PktFidMap || mPrimaryKeyType == PktInt || mPrimaryKeyType == PktUint64 )
2087
+ if ( !( flags & QgsFeatureSink::FastInsert ) )
2088
2088
{
2089
- insert += QLatin1String ( " RETURNING " );
2090
-
2091
- QString delim;
2092
- Q_FOREACH ( int idx, mPrimaryKeyAttrs )
2089
+ if ( mPrimaryKeyType == PktFidMap || mPrimaryKeyType == PktInt || mPrimaryKeyType == PktUint64 )
2093
2090
{
2094
- insert += delim + quotedIdentifier ( mAttributeFields .at ( idx ).name () );
2095
- delim = ' ,' ;
2091
+ insert += QLatin1String ( " RETURNING " );
2092
+
2093
+ QString delim;
2094
+ Q_FOREACH ( int idx, mPrimaryKeyAttrs )
2095
+ {
2096
+ insert += delim + quotedIdentifier ( mAttributeFields .at ( idx ).name () );
2097
+ delim = ' ,' ;
2098
+ }
2096
2099
}
2097
2100
}
2098
2101
@@ -2141,7 +2144,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist, Flags flags )
2141
2144
2142
2145
QgsPostgresResult result ( conn->PQexecPrepared ( QStringLiteral ( " addfeatures" ), params ) );
2143
2146
2144
- if ( result.PQresultStatus () == PGRES_TUPLES_OK )
2147
+ if ( !( flags & QgsFeatureSink::FastInsert ) && result.PQresultStatus () == PGRES_TUPLES_OK )
2145
2148
{
2146
2149
for ( int i = 0 ; i < mPrimaryKeyAttrs .size (); ++i )
2147
2150
{
@@ -2153,7 +2156,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist, Flags flags )
2153
2156
else if ( result.PQresultStatus () != PGRES_COMMAND_OK )
2154
2157
throw PGException ( result );
2155
2158
2156
- if ( mPrimaryKeyType == PktOid )
2159
+ if ( !( flags & QgsFeatureSink::FastInsert ) && mPrimaryKeyType == PktOid )
2157
2160
{
2158
2161
features->setId ( result.PQoidValue () );
2159
2162
QgsDebugMsgLevel ( QString ( " new fid=%1" ).arg ( features->id () ), 4 );
0 commit comments