<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 10.00.9200.16635"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=592224315-24072013><FONT color=#000080 
size=2 face=Arial>Yes the view does have the gid (I did not include all the 
fields of the view and stupidly forgit to t list the gid field in the 
email) below. I tried to use a different colum as unique key and select it AS 
gid instead which did not work (same error), then I added a new unique id 
using</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=592224315-24072013><FONT color=#000080 
size=2 face=Arial>nextval('myloc_loc_gid_seq'::regclass) AS gid (and omitted the 
old one), </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=592224315-24072013><FONT color=#000080 
size=2 face=Arial>still same error.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=592224315-24072013><FONT color=#000080 
size=2 face=Arial>what else should, itry - running  out of ideas 
</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=592224315-24072013></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=592224315-24072013><FONT color=#000080 
size=2 face=Arial>Cheers</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=592224315-24072013><FONT color=#000080 
size=2 face=Arial>Karsten</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=592224315-24072013><FONT color=#000080 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV lang=en-us class=OutlookMessageHeader dir=ltr align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Richard Greenwood 
[mailto:richard.greenwood@gmail.com] <BR><B>Sent:</B> Wednesday, July 24, 2013 
07:05 AM<BR><B>To:</B> karsten@terragis.net; PostGIS Users 
Discussion<BR><B>Cc:</B> PostGIS Users Discussion<BR><B>Subject:</B> Re: 
[postgis-users] PostGIS 2.02 view problem<BR></FONT><BR></DIV>
<DIV></DIV>
<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="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><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></BODY></HTML>