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"; 
xmlns:gml="http://www.opengis.net/gml"; xmlns:xxx="xxx" 
elementFormDefault="qualified" targetNamespace="xxx">
  <xsd:import namespace="http://www.opengis.net/gml"; 
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";>
<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=<Filter><PropertyIsEqualTo><PropertyName>GYLDIG_FRA</PropertyName><Literal>2009-01-26</Literal></PropertyIsEqualTo></Filter>
 
 
But that results in this:
 
<?xml version="1.0" ?>
<ServiceExceptionReport
   version="1.2.0"
   xmlns="http://www.opengis.net/ogc";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://www.opengis.net/ogc 
http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd";>
   <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

        

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to