Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle order by parsing failures in postgres provider
  • Loading branch information
nyalldawson committed Dec 20, 2015
1 parent f241059 commit dbb0919
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/providers/postgres/qgspostgresfeatureiterator.cpp
Expand Up @@ -153,8 +153,28 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource
if ( !success && useFallbackWhereClause )
{
//try with the fallback where clause, eg for cases when using compiled expression failed to prepare
mExpressionCompiled = false;
success = declareCursor( fallbackWhereClause, -1, false, orderByParts.join( "," ) );
if ( success )
mExpressionCompiled = false;
}

if ( !success && !orderByParts.isEmpty() )
{
//try with no order by clause
success = declareCursor( whereClause, -1, false );
if ( success )
mOrderByCompiled = false;
}

if ( !success && useFallbackWhereClause && !orderByParts.isEmpty() )
{
//try with no expression compilation AND no order by clause
success = declareCursor( fallbackWhereClause, -1, false );
if ( success )
{
mExpressionCompiled = false;
mOrderByCompiled = false;
}
}

if ( !success )
Expand Down

0 comments on commit dbb0919

Please sign in to comment.