Skip to content

Commit 874eb33

Browse files
author
jef
committed
apply #3242
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14748 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 0e3cc72 commit 874eb33

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/providers/postgres/qgspostgresprovider.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -3138,19 +3138,20 @@ bool QgsPostgresProvider::getGeometryDetails()
31383138
"from " ).arg( quotedIdentifier( geometryColumn ) );
31393139
if ( mUseEstimatedMetadata )
31403140
{
3141-
sql += QString( "(select %1 from %2 where %1 is not null limit %3) as t" )
3141+
sql += QString( "(select %1 from %2 where %1 is not null" )
31423142
.arg( quotedIdentifier( geometryColumn ) )
3143-
.arg( mQuery )
3144-
.arg( sGeomTypeSelectLimit );
3143+
.arg( mQuery );
3144+
if ( !sqlWhereClause.isEmpty() )
3145+
sql += " and " + sqlWhereClause;
3146+
sql += QString( " limit %1 ) as t" ).arg( sGeomTypeSelectLimit );
31453147
}
31463148
else
31473149
{
31483150
sql += mQuery;
3151+
if ( !sqlWhereClause.isEmpty() )
3152+
sql += " where " + sqlWhereClause;
31493153
}
31503154

3151-
if ( !sqlWhereClause.isEmpty() )
3152-
sql += " where " + sqlWhereClause;
3153-
31543155
result = connectionRO->PQexec( sql );
31553156

31563157
if ( PQntuples( result ) == 1 )

0 commit comments

Comments
 (0)