Bug report #4305

Query builder: added ' ' around numeric fields (wrong)

Added by Paolo Cavallini over 12 years ago. Updated over 12 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider
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

Description

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).

History

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

  • Status changed from Open to Feedback

not reproducable here - comparing numeric fields to strings containing numbers works fine with postgres and shapes.

#2 Updated by James Stott over 12 years ago

I get the same problem. Osgeo4w dev

#3 Updated by Giovanni Manghi over 12 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.

This query

"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[3] error 1: Type mismatch or improper type of arguments to = operator.

#4 Updated by Giovanni Manghi over 12 years ago

  • Target version set to Version 1.7.4

#5 Updated by Alexander Bruy over 12 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.

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

  • % Done changed from 0 to 100
  • Status changed from Feedback to Closed

Also available in: Atom PDF