Hi List, <br><br>This
 looks familiar to me but it&#39;s eluding my brain right now as to why. 
Mapserver / Postgis is generating an invalid SQL when trying to do an 
itemquery a layer. <br><br>Here&#39;s the error from mapserv cgi <br>
<br>
msPostGISLayerWhichShapes(): Query error. Error (ERROR:  argument of AND
 must be type boolean, not type integer
LINE 1: ...29.8659509))&#39;,find_srid(&#39;&#39;,<div id=":xs">&#39;parcel&#39;,&#39;the_geom&#39;)) and (50105)
                                                                 ^
) executing query: select 
&quot;id&quot;,&quot;transid&quot;,&quot;qpid&quot;,&quot;gis_acres&quot;,&quot;lastmodified&quot;,encode(ST_AsBinary(ST_Force_2D(&quot;the_geom&quot;),&#39;NDR&#39;),&#39;hex&#39;)
 as geom,&quot;id&quot; from (select * from parcel) as foo where the_geom 
&amp;&amp; GeomFromText(&#39;POLYGON((382577.69492276 
1555529.8659509,382577.69492276 1851596.8951139,832467.25879056 
1851596.8951139,832467.25879056 1555529.8659509,382577.69492276 
1555529.8659509))&#39;,find_srid(&#39;&#39;,&#39;parcel&#39;,&#39;the_geom&#39;)) and (50105)
<br><br>Notice the end of the sql it is missing (qpid = 50105) qpid being set as qitem is that not supposed to be there :)<br><br>Any assistance would be greatly appreciated :)<br><br>Paul<br><br>Here&#39;s the layer and versions ----<br>

<br>CGI params of interest: &amp;mode=itemquery&amp;qitem=qpid&amp;qstring=50105&amp;qformat=parcel_as_html&amp;qlayer=qparcel<br><br>Here&#39;s the layer:<br>--&gt;<br>  LAYER<br>    NAME &#39;qparcel&#39;<br>   <br>    INCLUDE &#39;projection.inc&#39;<br>

    INCLUDE &#39;dbconnection.inc&#39;<br>    DATA &#39;the_geom from (select * from parcel) as foo using unique id&#39;   <br>    <br>    TYPE POLYGON<br>    STATUS OFF<br>    METADATA<br>      qstring_validation_pattern &#39;.&#39; # should set this to a regex specific for this county<br>

    END<br>    CLASS<br>      NAME &#39;Selected Parcel&#39;<br>      OUTLINECOLOR 255 0 0<br>      SYMBOL &quot;circle&quot;<br>      SIZE 3<br>      LABEL<br>        COLOR 0 0 0<br>        SIZE SMALL<br>        MINDISTANCE 100<br>

      END<br>    END<br>    TEMPLATE &#39;void&#39;<br><br>  END<br>----&gt;<br><br>Postgis ver:<br>&quot;POSTGIS=&quot;1.5.3&quot; GEOS=&quot;3.3.1-CAPI-1.7.1&quot; PROJ=&quot;Rel. 4.7.1, 23 September 2009&quot; LIBXML=&quot;2.7.6&quot; USE_STATS&quot;<br>

<br>MapServer ver:<br>MapServer version 6.0.1 OUTPUT=GIF OUTPUT=PNG 
OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=CAIRO 
SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT
 SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER 
SUPPORTS=THREADS SUPPORTS=GEOS INPUT=POSTGIS INPUT=OGR INPUT=GDAL 
INPUT=SHAPEFILE</div>