Hello, I need help because I have bumped into a weird issue while migrating from Mapserver 4.6 to 4.8.<br>I have several applications running perfectly well based on MS4W 1.3.0. They´re developed in PHPMapscript and I use shapefile and POSTGIS data.<br>When I migrated to mapserver 4.8 (in MS4W 1.5.0), This error appears when I tried to query POSTGIS point layers (only postgis, not shapefiles):<br><br>----------------------------------------------------------------------------------------<br>Warning: [MapServer Error]: prepare_database(): Error executing POSTGIS DECLARE (the actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text from ejidos WHERE the_geom &amp;&amp; setSRID('BOX3D(5676966.1875 6041297.8425,5800095.4875 6139801.2825)'::BOX3D, find_srid('','ejidos','the_geom') )'<br><br>Postgresql reports the error as 'ERROR: cursor "mycursor" already exists '<br><br>More Help:<br><br>Error with
 POSTGIS data variable. You specified '&lt;check your .map file&gt;'.<br>Standard ways of specifiying are :<br>(1) 'geometry_column from geometry_table'<br>(2) 'geometry_column from (&lt;sub query&gt;) as foo using unique &lt;column name&gt; using SRID=&lt;srid#&gt;'<br><br>Make sure you put in the 'using unique &lt;column name&gt;' and 'using SRID=#' clauses in.<br><br>For more help, please see http://postgis.refractions.net/documentation/<br><br>Mappostgis.c - version of Jan 23/2004. in /opt/fgs/www/htdocs/BA2ss/index.php on line 115<br><br>Fatal error: Call to a member function on a non-object in /opt/fgs/www/htdocs/BA2ss/index.php on line 116 <br><br>----------------------------------------------------------------------------------------<br><br>Analyzing the problem I found out that error occurs when I query a point layer which has other layers below in the map file. For example if I have a cities layers over a state layer error occurs, but if I turn off the polygon
 layer don´t. I have to remark that this only happens with POINT layers.<br>I have to say that until mapserver 4.6 all worked perfectly!. By the way, I tried the code in a XP box and in a SUSE 10 one, and the same happens. I´m also using POSTGRESQL 8.1 with POSTGIS 1.1<br><br>The code I use to make the point queries is:<br>----------------------------------------------------------------------------------------<br>$pun_cons = ms_newpointobj();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $pun_cons-&gt;setxy($geo_x, $geo_y);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layerbyname = layer_seleccionado($_GET['obj_layer1']);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $capa_activa = $mapa-&gt;getLayerbyname($layerbyname);&nbsp; //layerObj getLayer(int index)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //$nombre_layer= $capa_activa-&gt;name; //nombre del layer activo consultado<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //$resul_cons =
 @$capa_activa-&gt;queryByPoint($pun_cons, MS_SINGLE, -1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(@$capa_activa-&gt;queryByPoint($pun_cons, MS_SINGLE,$tolerancia) == MS_FAILURE) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //return array("NO SE INTERSECTO RASGO!",$nombre_layer);//$resul_cons;//<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $vacio = "&lt;br&gt;&lt;table ALIGN = 'center' border='1' bgcolor='#99FF66'&gt;&lt;tr&gt;&lt;td&gt;Consulta Vacia&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return $vacio;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }else if ($capa_activa-&gt;status == MS_ON){<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $resultados =
 $capa_activa-&gt;getresult(0); //Returns a resultCacheMemberObj by index from a layer object withindex in the range 0 to numresults-1.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Returns a valid object or FALSE(0) if index is invalid.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $shape_index = $resultados-&gt;shapeindex;&nbsp;&nbsp; // Instances of ResultCacheMemberObj are always obtained
 through<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //layerObj's getResult() method.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $tile_index = $resultados-&gt;tileindex;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if($capa_activa-&gt;open() == MS_FAILURE) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return "No se pudo abrir ".$resultados-&gt;name;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 exit;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&amp;nbsp<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $shape = $capa_activa-&gt;getshape($tileindex, $shape_index);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $capa_activa-&gt;close;<br>----------------------------------------------------------------------------------------<br><br>Please help me if you can´t because I analized the code and as far as I know seems right to me.<br>Thanks in advance <br><br>Sergio<br>Argentina<br><br><br><p>
                <hr size=1> 
<a href="http://ar.autos.yahoo.com/">Yahoo! Autos</a>. Más de 100 vehículos vendidos por día.<br> 
¿Qué esperás para <B>vender</B> el tuyo? <br> 
<a href="http://ar.autos.yahoo.com/vender/"><B>Hacelo ahora y ganate un premio de Yahoo!</B></a>