[Geoserver-devel] [jira] Created: (GEOS-3661) GetFeature with filter containing an xsd:dateTime column

GetFeature with filter containing an xsd:dateTime column
--------------------------------------------------------

                 Key: GEOS-3661
                 URL: http://jira.codehaus.org/browse/GEOS-3661
             Project: GeoServer
          Issue Type: Bug
          Components: Oracle
    Affects Versions: 1.7.7
         Environment: Linux - Tomcat
            Reporter: Kasper Thuno
            Assignee: Andrea Aime

I am currently facing a problem when trying to request data from an Oracle database and filtering on a column which is an Oracle date and defined as an xsd:dateTime in Geoserver.

This is the output from DescribeFeatureType (I have shortened and anonymized it) :

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot; xmlns:gml="http://www.opengis.net/gml&quot; xmlns:xxx="xxx" elementFormDefault="qualified" targetNamespace="xxx">
  <xsd:import namespace="http://www.opengis.net/gml&quot; schemaLocation="xxx/schemas/gml/2.1.2/feature.xsd"/>
  <xsd:element name="xxx" substitutionGroup="gml:_Feature" type="xxx"/>
  <xsd:complexType name="xxx">
    <xsd:complexContent>
      <xsd:extension base="gml:AbstractFeatureType">
        <xsd:sequence>
                ...
          <xsd:element maxOccurs="1" minOccurs="0" name="GYLDIG_FRA" nillable="true" type="xsd:dateTime"/>
                ...
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
</xsd:schema>

This is output from GetFeature (without filter - again shortened and anonymized):

<wfs:FeatureCollection xsi:schemaLocation="xxx xxx/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=xxx http://www.opengis.net/wfs http://wfs.arealinfo.dk:80/schemas/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
<gml:boundedBy>
<gml:null>unknown</gml:null>
</gml:boundedBy>
<gml:featureMember>
<xxx fid="xxx.nfm-3da584d6_12507c6672d_-4d4">
        ...
<xxx:GYLDIG_FRA>2006-12-31</xxx:GYLDIG_FRA>
        ...
</xxx>
</gml:featureMember>
</wfs:FeatureCollection>

So the obvious would be to do the following:

http://xxx/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&PROPERTYNAME=*&MAXFEATURES=20&typename=xxx:xxx&FILTER=&lt;Filter&gt;&lt;PropertyIsEqualTo&gt;&lt;PropertyName&gt;GYLDIG\_FRA&lt;/PropertyName&gt;&lt;Literal&gt;2009\-01\-26&lt;/Literal&gt;&lt;/PropertyIsEqualTo&gt;&lt;/Filter&gt;

But that results in this:

<?xml version="1.0" ?>
<ServiceExceptionReport
   version="1.2.0"
   xmlns="http://www.opengis.net/ogc&quot;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
   xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd&quot;&gt;
   <ServiceException>
       error:Translator error
Translator error
Error reading Features
Could not aquire feature:org.geotools.data.DataSourceException: Error Performing SQL query: SELECT ... &quot;GYLDIG_FRA&quot;, ... WHERE &quot;GYLDIG_FRA&quot; = &apos;2009-01-26&apos;
Error Performing SQL query: SELECT ... &quot;GYLDIG_FRA&quot;, ... WHERE &quot;GYLDIG_FRA&quot; = &apos;2009-01-26&apos;
ORA-01861: literal does not match format string

</ServiceException></ServiceExceptionReport>

And whatever I do, Geoserver/Geotools insists on placing '' (single quotes) around the contents within <Literal>...</Literal> so using Oracle functions is not possible (which actually might be a good thing to avoid injection :-).
Doing the exact same thing from sqlplus yields a positive result, so it must be within Geoserver/Geotools that this problem resides.

SQL> select gyldig_fra from xxx where gyldig_fra = '2006-12-31';

GYLDIG_F
--------
06-12-31
06-12-31
...

Is this a bug or am I just doing something wrong???

(Note: I have also posted this on the mailing list without replies so far.)

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira