<div dir="ltr">Hi,<div><br></div><div>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 <a href="https://trac.osgeo.org/gdal/ticket/4253">https://trac.osgeo.org/gdal/ticket/4253</a> but I doubt if that works at all.<br></div><div><br></div><div>The code causing this problem is fairly generic (ogr_gensql.cpp)</div><div><br></div><div>if( psSelectInfo->where_expr && pszDialect != nullptr &&<br>            EQUAL(pszDialect, "OGRSQL") )<br>        {<br>            int nMinIndexForSpecialField = poSrcLayer->GetLayerDefn()->GetFieldCount();<br>            bForwardWhereToSourceLayer = !OGRGenSQLResultsLayerHasSpecialField<br>                            (psSelectInfo->where_expr, nMinIndexForSpecialField);<br>        }<br>        if (bForwardWhereToSourceLayer)<br>            pszWHERE = CPLStrdup(pszWHEREIn);<br>        else<br>            pszWHERE = nullptr;<br></div><div><br></div><div>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.</div><div><br></div><div>I'm also unsure if that is a correct action to omit passing "where" to the layer instead of providing an error message. <br></div><div><br></div><div>Is this a bug that should be fixed, or the OGRSQL dialect is considered as unsupported with OpenFileGDB?</div><div><br></div><div><br></div><div>Best regards,</div><div><br></div><div>Tamas</div><div><br></div></div>