Skip to content

Commit

Permalink
Don't quote column names for MIN and MAX for ogrsql
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jan 7, 2015
1 parent 1f8dee0 commit 790916b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -2346,7 +2346,8 @@ QVariant QgsOgrProvider::minimumValue( int index )
}
const QgsField& fld = mAttributeFields[index];

QByteArray sql = "SELECT MIN(" + quotedIdentifier( mEncoding->fromUnicode( fld.name() ) );
// Don't quote column name (see https://trac.osgeo.org/gdal/ticket/5799#comment:9)
QByteArray sql = "SELECT MIN(" + mEncoding->fromUnicode( fld.name() );
sql += ") FROM " + quotedIdentifier( OGR_FD_GetName( OGR_L_GetLayerDefn( ogrLayer ) ) );

if ( !mSubsetString.isEmpty() )
Expand Down Expand Up @@ -2384,7 +2385,8 @@ QVariant QgsOgrProvider::maximumValue( int index )
}
const QgsField& fld = mAttributeFields[index];

QByteArray sql = "SELECT MAX(" + quotedIdentifier( mEncoding->fromUnicode( fld.name() ) );
// Don't quote column name (see https://trac.osgeo.org/gdal/ticket/5799#comment:9)
QByteArray sql = "SELECT MAX(" + mEncoding->fromUnicode( fld.name() );
sql += ") FROM " + quotedIdentifier( OGR_FD_GetName( OGR_L_GetLayerDefn( ogrLayer ) ) );

if ( !mSubsetString.isEmpty() )
Expand Down

0 comments on commit 790916b

Please sign in to comment.