Skip to content
Permalink
Browse files

Handle order by parsing failures in postgres provider

  • Loading branch information
nyalldawson committed Dec 20, 2015
1 parent f241059 commit dbb0919749d7f2b8e87517827ecc02ace5b9290d
Showing with 21 additions and 1 deletion.
  1. +21 −1 src/providers/postgres/qgspostgresfeatureiterator.cpp
@@ -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 )

0 comments on commit dbb0919

Please sign in to comment.
You can’t perform that action at this time.