<div dir="ltr">In your map file you have "<span style="font-size:9pt;font-family:'Verdana','sans-serif'"><span style="color:rgb(0,50,100)"><span><font color="#000080" face="Arial">using unique gid". Are you sure that there is a "gid" column in your view?<br>
<br>Rich<br></font></span></span></span></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 24, 2013 at 3:35 AM, karsten <span dir="ltr"><<a href="mailto:karsten@terragis.net" target="_blank">karsten@terragis.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>



<div>
<div><span><font color="#000080" face="Arial">Hi 
all,</font></span></div>
<div><span><font color="#000080" face="Arial"></font></span> </div>
<div><span><font color="#000080" face="Arial">I am trying to use a b view in Postgis 2.0.2 ("POSTGIS="2.0.2 
r10789" GEOS="3.3.8-CAPI-1.7.8" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 
1.10.0, released 2013/04/24" LIBXML="2.8.0" LIBJSON="UNKNOWN" TOPOLOGY 
RASTER")</font></span></div>
<div><span><font color="#000080" face="Arial">for 
display via MapServer 6.2 </font></span></div>
<div><span><font color="#000080" face="Arial">I am 
getting an this error from MapServer:</font></span></div>
<div><span><font color="#000080" face="Arial"></font></span> </div>
<div><span><font color="#000080" face="Arial">Failed 
to draw layer named &#39;members&#39;.<br>msPostGISLayerWhichShapes(): 
Query error. Error executing query: ERROR:  column 
&quot;COUNT&quot; does not exist<br>LINE 1: select 
&quot;COUNT&quot;,encode(ST_AsBinary(ST_Force_2D(&quot;geom&quot;),&#39;NDR&#39;).</font></span></div>
<div><font color="#000080" face="Arial"></font> </div>
<div><span><font color="#000080" face="Arial">I have 
no idea why a count is needed here or where this field is coming from ...seems 
that the regular table have no issue with this. </font></span></div>
<div><span><font color="#000080" face="Arial"></font></span> </div>
<div><span><font color="#000080" face="Arial">My 
VIEW public.geometry_columns  shows these values for the 
view:</font></span></div>
<div><span><font color="#000080" face="Arial">"xy";"xy";"myloc";"geom";2;4269;"POINT"</font></span></div>
<div><span><font color="#000080" face="Arial"></font></span> </div>
<div><span><font color="#000080" face="Arial">What 
can I do to fix this in Postgis ?</font></span></div>
<div><span><font color="#000080" face="Arial">See 
below for view details</font></span></div>
<div><span><font color="#000080" face="Arial"></font></span> </div>
<div><span><font color="#000080" face="Arial">Cheers</font></span></div>
<div><span><font color="#000080" face="Arial">Karsten</font></span></div><span style="FONT-SIZE:9pt;FONT-FAMILY:'Verdana','sans-serif'">
<div><br><span style="COLOR:#003264">Terra GIS LTD<br></span></div>
<div><span style="COLOR:#003264"><span>-------------------------</span></span></div>
<div><span style="COLOR:#003264"><span>-- View: 
</span></span></div>
<div><span style="COLOR:#003264"><span><font color="#000080" face="Arial">CREATE OR REPLACE VIEW xy.test 
AS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          <br>
 SELECT 
xy.census_city_id, st_centroid(places.geom)::geometry(Point,4269) AS geom, 
<a href="http://places.name" target="_blank">places.name</a><br>   FROM 
myschema.xy,myschema.places                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <br>
  WHERE xy.census_city_id = 
places.geoid::integer;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
<br>ALTER TABLE 
myschema.xy_loc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         <br>
<br>OWNER TO 
myuser;     </font></span></span></div>
<div><span style="COLOR:#003264"><span><font color="#000080" face="Arial"></font></span></span> </div>
<div><span style="COLOR:#003264"><span><font color="#000080" face="Arial">-----------------------------------</font></span></span></div>
<div><span style="COLOR:#003264"><span><font color="#000080" face="Arial">in mapfile:</font></span></span></div>
<div><span style="COLOR:#003264"><span><font color="#000080" face="Arial"><br>DATA "geom from (select * from myschema.xy) 
as temp using unique gid using SRID=4269"  
</font></span></span></div></span></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Richard Greenwood<br><a href="mailto:richard.greenwood@gmail.com">richard.greenwood@gmail.com</a><br><a href="http://www.greenwoodmap.com">www.greenwoodmap.com</a>
</div>