When I configure my layer as DATA &quot;the_geom from &lt;table_name&gt; AS foo USING UNIQUE gid&quot;<br>Mapserver returns the following error:<br><br>&lt;ServiceExceptionReport version=&quot;1.1.0&quot;&gt;<br>−<br>&nbsp;&nbsp;&nbsp; &lt;ServiceException&gt;
<br><br>msDrawMap(): Image handling error. Failed to draw layer named &#39;percelen&#39;.<br>prepare_database(): Query error. Error executing POSTGIS DECLARE (the actual query) statement: &#39;DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(the_geom)),&#39;NDR&#39;),gid::text from b_capa_percid AS foo WHERE the_geom &amp;&amp; setSRID(&#39;BOX3D(
76945.5918856108 189996.502536997,91328.1081143621 201805.497460877)&#39;::BOX3D, find_srid(&#39;&#39;,&#39;b_capa_percid AS foo&#39;,&#39;the_geom&#39;) )&#39; <br><br>Postgresql reports the error as &#39;ERROR:&nbsp; find_srid() - couldnt find the corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS table?&nbsp; Is there an uppercase/lowercase missmatch?
<br>&#39;<br><br>More Help:<br><br>Error with POSTGIS data variable. You specified &#39;check your .map file&#39;.<br>Standard ways of specifiying are : <br>(1) &#39;geometry_column from geometry_table&#39; <br>(2) &#39;geometry_column from (sub query) as foo using unique column name using SRID=srid#&#39; 
<br><br>Make sure you put in the &#39;using unique&nbsp; column name&#39; and &#39;using SRID=#&#39; clauses in.<br><br>For more help, please see <a href="http://postgis.refractions.net/documentation/">http://postgis.refractions.net/documentation/
</a> <br><br>Mappostgis.c - version of Jan 23/2004.<br><br>&lt;/ServiceException&gt;<br>&lt;/ServiceExceptionReport&gt;<br><br><br>However when I add the SRID=31300, Mapserver throws this:<br><br><br>−<br>&nbsp;&nbsp;&nbsp; &lt;ServiceExceptionReport version=&quot;
1.1.0&quot;&gt;<br>−<br>&nbsp;&nbsp;&nbsp; &lt;ServiceException&gt;<br><br>msDrawMap(): Image handling error. Failed to draw layer named &#39;percelen&#39;.<br>msPOSTGISLayerWhichShapes(): Query error. Error executing POSTGIS SQL statement (in FETCH ALL): DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(the_geom)),&#39;NDR&#39;),gid::text from b_capa_percid AS foo WHERE the_geom &amp;&amp; setSRID(&#39;BOX3D(
76945.5918856108 189996.502536997,91328.1081143621 201805.497460877)&#39;::BOX3D, 31300 )<br>-ERROR:&nbsp; Operation on two geometries with different SRIDs<br><br><br>&lt;/ServiceException&gt;<br>&lt;/ServiceExceptionReport&gt;
<br><br><br>How can I use the gid as unique column ?<br><br>Thanks <br>Steven<br>