Skip to content

Commit a525dbd

Browse files
author
Sandro Santilli
committed
Use ST_Force2D from PostGIS-2.1.0 up
1 parent d2d6813 commit a525dbd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/providers/postgres/qgspostgresfeatureiterator.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,12 @@ bool QgsPostgresFeatureIterator::declareCursor( const QString& whereClause )
322322
if ( mSource->mForce2d )
323323
{
324324
geom = QString( "%1(%2)" )
325-
.arg( mConn->majorVersion() < 2 ? "force_2d" : "st_force_2d" )
325+
// Force_2D before 2.0
326+
.arg( mConn->majorVersion() < 2 ? "force_2d"
327+
// ST_Force2D since 2.1.0
328+
: mConn->majorVersion() > 2 || mConn->minorVersion() > 0 ? "st_force2d"
329+
// ST_Force_2D in 2.0.x
330+
: "st_force_2d" )
326331
.arg( geom );
327332
}
328333

0 commit comments

Comments
 (0)