id summary reporter owner description type status priority milestone component version severity resolution keywords cc 4507 SQL drivers : bad AND priority when spatial and attribute filter are combined Even Rouault warmerdam "At least for PG, MySQL, SQLite and MSSpatial driver (and probably in other drivers), when we build the where clause, we build something like ""WHERE spatial_filter AND attribute_filter"". The issue is that if attribute_filter contains a OR, we end up with ""WHERE spatial_filter AND attribute_filter_part1 OR attribute_filter_part2"", which evaluates to ""WHERE (spatial_filter AND attribute_filter_part1) OR attribute_filter_part2"". Which queries more features than really necessary. Generally, you won't notice it since client side spatial filtering will still be done. But this can be sometimes seen when running GetFeatureCount()." defect closed normal 1.9.1 OGR_SF unspecified normal fixed tamas