Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

QueryBuilder throws an error with type date #996

Open
adahinden opened this issue Aug 31, 2015 · 3 comments
Open

QueryBuilder throws an error with type date #996

adahinden opened this issue Aug 31, 2015 · 3 comments

Comments

@adahinden
Copy link

The query builder plugin throws an error if you choose a field with date type and the comparison ("=") or the contains ("beinhaltet") operator. See the attached image.

image

The error that mapserver returns:

comparison operator:
<ows:ExceptionText>msWFSGetFeature(): WFS server error. FLTApplyFilterToLayer() failed msPostGISLayerWhichShapes(): Query error. Error (ERROR: function lower(date) does not exist LINE 1: ... 278000,690000 218000,620000 218000))',-1) and ( (lower("dat... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. ) executing query: select "id","time","name","vorname","adresse_form","plz","ort","email","telefon","zweck","meta_title","meta_comment","meta_layout","meta_scale","meta_rotation","meta_layers","meta_center_x","meta_center_y","meta_pdf_name","datum","zeit","meta_pdf_link",encode(ST_AsBinary(ST_Force_2D("geom"),'NDR'),'hex') as geom,"id" from (SELECT geo.* FROM stat.view_printlog AS geo) AS foo where geom &amp;&amp; GeomFromText('POLYGON((620000 218000,620000 278000,690000 278000,690000 218000,620000 218000))',-1) and ( (lower("datum") = lower('2015-08-31T00:00:00+02:00') ) ) msEvalRegex(): Regular expression error. String failed expression test.</ows:ExceptionText> </ows:Exception>

contains operator:
<ows:ExceptionText>msWFSGetFeature(): WFS server error. FLTApplyFilterToLayer() failed msPostGISLayerWhichShapes(): Query error. Error (ERROR: operator does not exist: date ~~* text LINE 1: ...690000 218000,620000 218000))',-1) and ( ("datum" ilike '%20... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. ) executing query: select "id","time","name","vorname","adresse_form","plz","ort","email","telefon","zweck","meta_title","meta_comment","meta_layout","meta_scale","meta_rotation","meta_layers","meta_center_x","meta_center_y","meta_pdf_name","datum","zeit","meta_pdf_link",encode(ST_AsBinary(ST_Force_2D("geom"),'NDR'),'hex') as geom,"id" from (SELECT geo.* FROM stat.view_printlog AS geo) AS foo where geom &amp;&amp; GeomFromText('POLYGON((620000 218000,620000 278000,690000 278000,690000 218000,620000 218000))',-1) and ( ("datum" ilike '%2015-08-31T00:00:00+02:00%' escape '!') )</ows:ExceptionText> </ows:Exception>

I think the "contains operator" does not make sense on a date type field and therefore it should not be displayed for the user.

@ochriste
Copy link
Member

the QueryBuilder has no understanding of the field type, in this case date or timestamp, and therefor cant filter out operator.
it may be possible to implement such filtering but at the price of a high increase of the complexity of the code.
you should check with the community if there is a will to finance that.

@adahinden
Copy link
Author

Would there be a less complicated way if we disappear just the "=" and "contains" operators for the user?

@sbrunner sbrunner added this to the 1.6.3 milestone Aug 31, 2015
@sbrunner
Copy link
Member

Linked to georchestra/styler#9

@ger-benjamin ger-benjamin modified the milestones: 1.6.5, 1.6.3 Sep 30, 2015
@sbrunner sbrunner modified the milestones: 2.0, 1.6.5 Oct 12, 2015
@sbrunner sbrunner removed this from the 2.0 milestone Sep 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants