Bug report #12638

ORDER BY clause in filter does not accept quoted field names

Added by mlennert - about 9 years ago. Updated about 9 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 #:20753


Trying to order my shapefile point data in QGIS 2.4 (Debian testing version) for proportionate symbol mapping in order to have the largest symbols below the smallest, I use the following clause in the layer's filter:

1=1 ORDER BY "pop_2001" desc

This however gives me

OGR [3] error 1: SQL Expression Parsing Error: syntax error

When I leave out the quotation marks (inserted automatically by the GUI):

1=1 ORDER BY pop_2001 desc

everything works as expected.

I don't have this problem when I access a postgis table via the OGR provider, i.e. I can use quoted field names there.

However, when I access the same table via the postgis provider, the result of the query is empty !

So the whole thing seems to be provider specific...


#1 Updated by Giovanni Manghi about 9 years ago

  • Affected QGIS version changed from 2.4.0 to master

It happens also on 2.8.1/master.

#2 Updated by Jürgen Fischer about 9 years ago

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

The subset strings are indeed provider specific, but they are generally supposed to be where clauses only - using "ORDER BY" isn't supported.

Also available in: Atom PDF