Hi, It looks like the sql queries with -dialect "OGRSQL" doesn't seem to work as expected. When I specify the FID in the where clause, it doesn't filter anything. The same query is also described as a solution in the following ticket https://trac.osgeo.org/gdal/ticket/4253 but I doubt if that works at all.
The code causing this problem is fairly generic (ogr_gensql.cpp) if( psSelectInfo->where_expr && pszDialect != nullptr && EQUAL(pszDialect, "OGRSQL") ) { int nMinIndexForSpecialField = poSrcLayer->GetLayerDefn()->GetFieldCount(); bForwardWhereToSourceLayer = !OGRGenSQLResultsLayerHasSpecialField (psSelectInfo->where_expr, nMinIndexForSpecialField); } if (bForwardWhereToSourceLayer) pszWHERE = CPLStrdup(pszWHEREIn); else pszWHERE = nullptr; In the "where" expression, the FID field is thanslated to OBJECTID and it is now treated as a special field, therefore the "where" expression is not being passed to the driver. I'm also unsure if that is a correct action to omit passing "where" to the layer instead of providing an error message. Is this a bug that should be fixed, or the OGRSQL dialect is considered as unsupported with OpenFileGDB? Best regards, Tamas
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev