Bug report #9958

Filter fails on file datasource if value is identical to field name

Added by Regis Haubourg over 8 years ago. Updated over 8 years ago.

Affected QGIS version:2.2.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:up/downstream
Crashes QGIS or corrupts data:No Copied to github as #:18456


Hi, a user raised a nasty bug here on qgis 2.2:

when filtering (right click on the layer) a file layer (tested shp, tab and postgis), if typing an expression like

"MyField" = 'MYFIELD'

then no filter is applied.

Case seems unrelated, I have also tested with another datasource where "myfield" = 'MYFIELD'

In Master and 2.2, '!=' and '<>' , and 'not like 'MyField' are affected.

Marking it as a blocker since this can be really misleading, and user may not be aware of it.


bug_qgis_filter_fieldname.png (123 KB) Regis Haubourg, 2014-03-31 02:13 AM

bug_qgis_fieldnamefilter.zip (239 KB) Regis Haubourg, 2014-03-31 02:36 AM


#1 Updated by Nathan Woodrow over 8 years ago

This is done by the data provider. Which data source are you using, this might be a OGR bug.

#2 Updated by Regis Haubourg over 8 years ago

Hi Nathan, shp and tab tested. I joined a shapefile sample if you need to reproduce.

#3 Updated by Nathan Woodrow over 8 years ago

Yeah I think this would be a ogr issue because it just passes the query as a -where arg.

#4 Updated by Regis Haubourg over 8 years ago

You're right,
ogrinfo -al -geom=NO -where "TPME = 'GME'" F:\\temp\\bug_qgis_filter_fieldname.shp

and the bug is here...
I open a ticket in gdal ogr tracker

#5 Updated by Giovanni Manghi over 8 years ago

  • Status changed from Open to Closed
  • Resolution set to up/downstream

#6 Updated by Jürgen Fischer over 8 years ago

Regis Haubourg wrote:

and the bug is here...

So this doesn't apply to the postgres provider (with estimated metadata turned off)?

#7 Updated by Regis Haubourg over 8 years ago

ticket created here GDAL #5428

Also available in: Atom PDF