Bug report #5536

Rule based symbology refine assistant forgets quotation marks for fields with special characters

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

Status:Closed
Priority:Normal
Assignee:-
Category:Symbology
Affected QGIS version:1.7.4 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:15129

Description

Tested with Qgis 1.7.4 standalone and qgis 1.8.0.4 from osgeow.

When trying to refine rules in rule based labeling interface, if field names contain spaces or non ascii characters, automatically generated rules queries do not include quotation mark for the field. See pictures attached and sample shapefile.
Ex: I get Montant re > '1000' instead of "Montant re" > 1000.
Map rendering is false but is rendered without any error message.

When testing each expression within the definition Query, error message raises "Filter expression parsing error:
syntax error, unexpected COLUMN_REF, expecting $end" . Putting quotation mark by hands gives a correct behaviour. Generating rules by hand, without using "refine" button does generate quotation marks.

- Possible other feature request : Newcoming users don't know that special characters is a bad pratice for fields names. Maybe a automatical clean in ogr export could be a good thing for shapefile at least.

- remark (not a bug): Another strange behaviour is that numerical values in range refining are quoted myfield > '1000' instead of Montant re > 1000. Could this affect performance since a type cast is necessary?

Cheers
régis

rule_query_quotation_mark_missing.jpeg - quotation mark missing and error when testing expression (127 KB) Regis Haubourg, 2012-05-03 06:01 AM

rule_query_quotation_mark_back.jpeg - quotation mark corrected by hand OK (16.1 KB) Regis Haubourg, 2012-05-03 06:01 AM

industrie.zip - sample shape (field "Montant re" or "Numéro Con" (33.7 KB) Regis Haubourg, 2012-05-03 06:01 AM

Associated revisions

Revision f2c4f539
Added by Hugo Mercier over 12 years ago

refs #5536
Escape field names in refine rules functions

History

#1 Updated by Giovanni Manghi over 12 years ago

  • Category changed from Map Legend to Symbology
  • Subject changed from Rule based Labeling refine assistant forgets quotation marks for fields with special characters to Rule based symbology refine assistant forgets quotation marks for fields with special characters

#2 Updated by Hugo Mercier over 12 years ago

Fixed (pull request: https://github.com/qgis/Quantum-GIS/pull/156).

Double quotes are now added to field names. Field names are also escaped and can contain accents (tested with some french accents), spaces, as well as quotes and double quotes.

#3 Updated by Martin Dobias over 12 years ago

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

fixed in bf86521d4

Also available in: Atom PDF