Bug report #10165
Cannot use "less than"/"greater than" operators on date fields
Status: | Closed | ||
---|---|---|---|
Priority: | Severe/Regression | ||
Assignee: | Matthias Kuhn | ||
Category: | Data Provider/OGR | ||
Affected QGIS version: | master | 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 #: | 18619 |
Description
(This is a follow-up ticket of #9241)
There is an issue querying date fields: I cannot seem to use < and > operators in queries:
OGR[3] error 1: Type mismatch or improper type of arguments to < operator.
Related issues
History
#1 Updated by Anita Graser over 10 years ago
- Priority changed from Normal to High
This is kind of a regression since filtering dates used to work when they were still interpreted as strings instead of datetimes.
#2 Updated by Anita Graser over 10 years ago
- Assignee set to Matthias Kuhn
#3 Updated by Giovanni Manghi over 10 years ago
Anita Graser wrote:
This is kind of a regression since filtering dates used to work when they were still interpreted as strings instead of datetimes.
if it is a regression I would suggest tag this ticket as blocker. Cheers!
#4 Updated by Anita Graser over 10 years ago
- Priority changed from High to Severe/Regression
#5 Updated by Anita Graser over 10 years ago
Is this an upstream OGR issue again or is this a QGIS issue?
#6 Updated by Matthias Kuhn over 10 years ago
Hi Anita,
Can you attach sample data?
#7 Updated by Anita Graser over 10 years ago
The dataset from the previous ticket is still up at http://ge.tt/6DBclJh/v/0
#8 Updated by Matthias Kuhn over 10 years ago
- Status changed from Open to Feedback
And what exactly are you trying to do?
I.e. how do you specify the query?
#9 Updated by Anita Graser over 10 years ago
I get the error when trying to specify the query manually in Layer Properties or automatically through Time Manager plugin.
#10 Updated by Matthias Kuhn over 10 years ago
- Status changed from Feedback to Closed
- Resolution set to up/downstream
I think you are referring to "Feature subset"?
That is passed to the provider and never evaluated by QGIS and therefore looks like an upstream issue.
You can try on the command line to find a syntax that works.
ogrinfo test2.shp -sql 'SELECT COUNT(*) FROM test2 WHERE DATE < "1970-01-01"' INFO: Open of `test2.shp' using driver `ESRI Shapefile' successful. Layer name: test2 Geometry: Point Feature Count: 1 Layer SRS WKT: (unknown) COUNT_*: Integer (0.0) OGRFeature(test2):0 COUNT_* (Integer) = 3
ogrinfo --version GDAL 1.10.1, released 2013/08/26
#11 Updated by Anita Graser over 10 years ago
I just tested again and the same feature subset query which works in QGIS 2.2 fails with type mismatch error in today's master.
Update: 2.2 uses OGR 1.10.1, master uses OGR 1.11.0
#12 Updated by Anita Graser over 10 years ago
- Subject changed from Cannot use "smaller than"/"bigger than" operators on date fields to Cannot use "less than"/"greater than" operators on date fields
This is the upstream ticket: http://trac.osgeo.org/gdal/ticket/5507
Not sure if this ticket here should be closed already as long as the upstream issue is not fixed?
#13 Updated by Matthias Kuhn over 10 years ago
If it's really what it looks like, we cannot do anything about it on QGIS side, so there is no reason to leave this ticket open.
You probably need to adjust your subquery string to match the date format OGR expects.