<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Hi,<br>
    <br>
    You could possibly try to set a layer level metadata to indicate the
    type:<br>
    &nbsp;"gml_code_dept_type" "Character"<br>
    <br>
    Please also indicate what version of MapServer.<br>
    <br>
    best regards,<br>
    <br>
    On 10/12/2010 8:00 PM, Thomas Gratier wrote:
    <blockquote
      cite="mid:AANLkTikE=NO+pHcm_BCCBH9z_xmGxO3-9ZNo74-ZTZ1Y@mail.gmail.com"
      type="cite">Hello list,<br>
      <br>
      Filter encoding seems to suffer from a type problem with Postgis.
      I want to confirm the problem and check I don't miss something.<br>
      <br>
      So my use case.<br>
      I have created a Postgis table.<br>
      The structure of the table starts with<br>
      <br>
      CREATE TABLE departement<br>
      (<br>
      &nbsp; gid serial NOT NULL,<br>
      &nbsp; id_geofla numeric(10,0),<br>
      &nbsp; code_dept character varying(2),<br>
      &nbsp; nom_dept character varying(30),<br>
      &nbsp; the_geom geometry,<br>
      ....<br>
      <br>
      I use this postgis layer in a WFS webservices<br>
      A query like <a moz-do-not-send="true"
href="http://localhost/cgi-bin/mapserv?map=/home/test/SIG/france/mapfiles/mapfile_carte.map&amp;REQUEST=GetFeature&amp;SERVICE=WFS&amp;VERSION=1.0.0&amp;TYPENAME=departements&amp;OUTPUT=gml">http://localhost/cgi-bin/mapserv?map=/home/test/SIG/france/mapfiles/mapfile_carte.map&amp;REQUEST=GetFeature&amp;SERVICE=WFS&amp;VERSION=1.0.0&amp;TYPENAME=departements&amp;OUTPUT=gml</a>
      works.<br>
      <br>
      When I use a filter like<br>
      <a moz-do-not-send="true"
href="http://localhost/cgi-bin/mapserv?map=/home/test/SIG/france/mapfiles/mapfile_carte.map&amp;REQUEST=GetFeature&amp;SERVICE=WFS&amp;VERSION=1.0.0&amp;TYPENAME=departements&amp;OUTPUT=gml&amp;Filter=">http://localhost/cgi-bin/mapserv?map=/home/test/SIG/france/mapfiles/mapfile_carte.map&amp;REQUEST=GetFeature&amp;SERVICE=WFS&amp;VERSION=1.0.0&amp;TYPENAME=departements&amp;OUTPUT=gml&amp;Filter=</a>&lt;Filter&gt;&lt;PropertyIsEqualTo&gt;&lt;PropertyName&gt;code_dept&lt;/PropertyName&gt;&lt;Literal&gt;01&lt;/Literal&gt;&lt;/PropertyIsEqualTo&gt;&lt;/Filter&gt;<br>
      there is an error with the message below.<br>
      &lt;ServiceExceptionReport version="1.2.0" xmlns="<a
        moz-do-not-send="true" href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a>"
      xmlns:xsi="<a moz-do-not-send="true"
        href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"
      xsi:schemaLocation="<a moz-do-not-send="true"
        href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a>
      <a moz-do-not-send="true"
        href="http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd</a>"&gt;<br>
      &lt;ServiceException code="NoApplicableCode" locator="mapserv"&gt;<br>
      msWFSGetFeature(): WFS server error. FLTApplyFilterToLayer()
      failed msPostGISLayerWhichShapes(): Query error. Error (ERREUR:
      l'op&eacute;rateur n'existe pas : character varying = integer LINE 1:
      ...d_srid('','departement','the_geom')) and ( (code_dept= 01) ) ^
      HINT: Aucun op&eacute;rateur ne correspond au nom donn&eacute; et aux types
      d'arguments. Vous devez ajouter des conversions explicites de
      type. ) executing query: select
      "gid","id_geofla","code_dept","nom_dept",encode(AsBinary(force_collection(force_2d("the_geom")),'NDR'),'hex')
      as geom,"oid" from departement where the_geom &amp;&amp;
      GeomFromText('POLYGON((-25000000 -25000000,-25000000
      25000000,25000000 25000000,25000000 -25000000,-25000000
      -25000000))',find_srid('','departement','the_geom')) and (
      (code_dept= 01) ) <br>
      &lt;/ServiceException&gt;<br>
      &lt;/ServiceExceptionReport&gt;<br>
      <br>
      It seems to come from cast : mapserver receives the parameter from
      the url but doesn't check type and considers the retrieved value
      as an integer (because there is no quotes)<br>
      This problem occurs with Postgis but not with a shapefile (the
      same url works...). I've done some test with oid = true but
      nothing changes too<br>
      <br>
      Regards<br>
      <br>
      ThomasG<br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
mapserver-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapserver-dev@lists.osgeo.org">mapserver-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapserver-dev">http://lists.osgeo.org/mailman/listinfo/mapserver-dev</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
----------------------------------------------------------------
Assefa Yewondwossen           
Software Analyst   

Email: <a class="moz-txt-link-abbreviated" href="mailto:yassefa@dmsolutions.ca">yassefa@dmsolutions.ca</a>    
<a class="moz-txt-link-freetext" href="http://www.dmsolutions.ca/">http://www.dmsolutions.ca/</a>

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------

</pre>
  </body>
</html>