Bug report #6690

builder query gives wrong results with shapes (OGR bug?)

Added by Richard Duivenvoorde over 7 years ago. Updated over 7 years ago.

Category:Data Provider
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:wontfix
Crashes QGIS or corrupts data:No Copied to github as #:15857


if I open the attached shape file in QGIS master ( Compiled against GDAL/OGR 1.9.2 ), I can create the following query in QGIS:

"GEEL" = 'geel'

I can do that via:
A) the menu -> Layer -> Query
B) via show attribute table, make editable, button 'Advanced Search'

Using this exact same query in the first case returns all (175) rows, in the second case it returns 48 rows (the result I'm expecting).

Discussing this with NathanW, it appears that the dialog in case A uses OGR for the query while for case B the work is done by QGIS.

So either there is a bug in OGR, OR we are not using the right syntax for this query (for QGR), OR there is something else wrong (at least from a user point of view: it is not logical that this exact same QGIS dialog is giving different results when called from different places)

test.zip - test2.shp file to be queried (94.8 KB) Richard Duivenvoorde, 2012-11-14 03:29 AM

48.png (117 KB) Richard Duivenvoorde, 2012-11-14 03:29 AM

175.png (84.3 KB) Richard Duivenvoorde, 2012-11-14 03:29 AM

Related issues

Duplicated by QGIS Application - Bug report #13656: LIKE is not case sensitive when Query Builder is accessed... Closed 2015-10-22
Duplicated by QGIS Application - Bug report #8129: Vector feature subset query uses ilike as like for non-la... Closed 2013-06-21


#1 Updated by Jürgen Fischer over 7 years ago

  • Resolution set to wontfix
  • Status changed from Open to Closed

This came up before - although I can seem to find the ticket.

The layer subset strings (ie. Layer/Query) are provider specific. E.g. in PostgreSQL you can use arbitrary complex strings/where clauses (like EXISTS (SELECT ... FROM someothertable WHERE ...)).

For OGR it depends on the datasource's driver. For shapes OGR SQL is used. There apparenty "GEEL" refers to a string and moreover = is case-insensitive. So to OGR everything is yellow.

Also available in: Atom PDF