Bug report #4305
Query builder: added ' ' around numeric fields (wrong)
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||14242|
When building a query with the query builder, ' are added surrounding any field, including numeric ones; as a consequence, queries fail. It is a regression (it worked until recently).
#3 Updated by Giovanni Manghi about 9 years ago
Jürgen Fischer wrote:
not reproducable here - comparing numeric fields to strings containing numbers works fine with postgres and shapes.
I can confirm also on trunk on shapefiles.
"POP2010" = '60000'
works if the layer is a PostGIS one, but fails on shapefiles (POP2010 is an integer field)
An error occurred when executing the query.
The data provider said:
OGR error 1: Type mismatch or improper type of arguments to = operator.
#5 Updated by Alexander Bruy almost 9 years ago
- Affected QGIS version set to master
- Crashes QGIS or corrupts data set to No
More info in this bug. Query fails only when Query builder opened from layer context menu or from layer properties dialog (when query used to limit visible features). If query builder opened from attribute table Advanced search - all works fine. I think this is because in one case QgsQgsSearchQueryBuilder used and in another QgsQueryBuilder.