@@ -1825,7 +1825,7 @@ bool QgsPostgresProvider::deleteFeatures( const QgsFeatureIds & id )
1825
1825
1826
1826
// send DELETE statement and do error handling
1827
1827
QgsPostgresResult result = mConnectionRW ->PQexec ( sql );
1828
- if ( result.PQresultStatus () != PGRES_COMMAND_OK )
1828
+ if ( result.PQresultStatus () != PGRES_COMMAND_OK && result. PQresultStatus () != PGRES_TUPLES_OK )
1829
1829
throw PGException ( result );
1830
1830
1831
1831
mShared ->removeFid ( *it );
@@ -2036,7 +2036,7 @@ bool QgsPostgresProvider::changeAttributeValues( const QgsChangedAttributesMap &
2036
2036
sql += QString ( " WHERE %1" ).arg ( whereClause ( fid ) );
2037
2037
2038
2038
QgsPostgresResult result = mConnectionRW ->PQexec ( sql );
2039
- if ( result.PQresultStatus () != PGRES_COMMAND_OK )
2039
+ if ( result.PQresultStatus () != PGRES_COMMAND_OK && result. PQresultStatus () != PGRES_TUPLES_OK )
2040
2040
throw PGException ( result );
2041
2041
2042
2042
// update feature id map if key was changed
@@ -2165,7 +2165,7 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
2165
2165
QgsDebugMsg ( " updating: " + update );
2166
2166
2167
2167
result = mConnectionRW ->PQprepare ( " updatefeatures" , update, 2 , NULL );
2168
- if ( result.PQresultStatus () != PGRES_COMMAND_OK )
2168
+ if ( result.PQresultStatus () != PGRES_COMMAND_OK && result. PQresultStatus () != PGRES_TUPLES_OK )
2169
2169
{
2170
2170
QgsDebugMsg ( QString ( " Exception thrown due to PQprepare of this query returning != PGRES_COMMAND_OK (%1 != expected %2): %3" )
2171
2171
.arg ( result.PQresultStatus () ).arg ( PGRES_COMMAND_OK ).arg ( update ) );
@@ -2203,13 +2203,8 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
2203
2203
appendPkParams ( iter.key (), params );
2204
2204
2205
2205
result = mConnectionRW ->PQexecPrepared ( " updatefeatures" , params );
2206
- int expected_status = ( mSpatialColType == sctTopoGeometry ) ? PGRES_TUPLES_OK : PGRES_COMMAND_OK;
2207
- if ( result.PQresultStatus () != expected_status )
2208
- {
2209
- QgsDebugMsg ( QString ( " Exception thrown due to PQexecPrepared of 'updatefeatures' returning %1 != expected %2" )
2210
- .arg ( result.PQresultStatus () ).arg ( expected_status ) );
2206
+ if ( result.PQresultStatus () != PGRES_COMMAND_OK && result.PQresultStatus () != PGRES_TUPLES_OK )
2211
2207
throw PGException ( result );
2212
- }
2213
2208
2214
2209
if ( mSpatialColType == sctTopoGeometry )
2215
2210
{
@@ -2695,6 +2690,7 @@ bool QgsPostgresProvider::getGeometryDetails()
2695
2690
}
2696
2691
layerProperty.geometryColName = mGeometryColumn ;
2697
2692
layerProperty.geometryColType = sctNone;
2693
+ layerProperty.force2d = false ;
2698
2694
2699
2695
QString delim = " " ;
2700
2696
@@ -2762,7 +2758,8 @@ bool QgsPostgresProvider::getGeometryDetails()
2762
2758
// store whether the geometry includes measure value
2763
2759
if ( detectedType == " POINTM" || detectedType == " MULTIPOINTM" ||
2764
2760
detectedType == " LINESTRINGM" || detectedType == " MULTILINESTRINGM" ||
2765
- detectedType == " POLYGONM" || detectedType == " MULTIPOLYGONM" )
2761
+ detectedType == " POLYGONM" || detectedType == " MULTIPOLYGONM" ||
2762
+ mForce2d )
2766
2763
{
2767
2764
// explicitly disable adding new features and editing of geometries
2768
2765
// as this would lead to corruption of measures
0 commit comments