Skip to content

Commit

Permalink
postgres provider: fix type retrieval for layers with where clause
Browse files Browse the repository at this point in the history
(cherry picked from commit 749269c)
  • Loading branch information
jef-n committed Jun 4, 2020
1 parent 537a247 commit f4e5810
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/providers/postgres/qgspostgresconn.cpp
Expand Up @@ -1758,10 +1758,10 @@ void QgsPostgresConn::retrieveLayerTypes( QVector<QgsPostgresLayerProperty *> &l
// our estimatation ignores that a where clause might restrict the feature type or srid
if ( useEstimatedMetadata )
{
table = QStringLiteral( "(SELECT %1 FROM %2%3 WHERE %1 IS NOT NULL LIMIT %4) AS t" )
table = QStringLiteral( "(SELECT %1 FROM %2 WHERE %3%1 IS NOT NULL LIMIT %4) AS t" )
.arg( quotedIdentifier( layerProperty.geometryColName ),
table,
layerProperty.sql.isEmpty() ? QString() : QStringLiteral( " WHERE %1" ).arg( layerProperty.sql ) )
layerProperty.sql.isEmpty() ? QString() : QStringLiteral( " (%1) AND " ).arg( layerProperty.sql ) )
.arg( GEOM_TYPE_SELECT_LIMIT );
}
else if ( !layerProperty.sql.isEmpty() )
Expand Down

0 comments on commit f4e5810

Please sign in to comment.