<html>
<body>
Hi all,<br>
I'm having a problem with a layer coming from a PostGIS connection.<br>
This layer has a JOIN relating the geometry table with a second table
holding text data:<br><br>
[...]<br>
DATA 'the_geom FROM (SELECT thegeom_elementi_puntuali.*, colate.* FROM
thegeom_elementi_puntuali LEFT JOIN colate ON
thegeom_elementi_puntuali.uc_lege=colate.uc_lege) AS foo USING UNIQUE gid
USING SRID=3004'<br>
[...]<br><br>
The layer works perfectly to retrieve data but FAILS when is queryed
using queryByPoint<br><br>
The problems seems to be the presence of two fields with the same name:
&quot;uc_lege&quot;.<br>
I tried to fully qualify the names of the field in this way:<br><br>
[...]<br>
DATA 'the_geom FROM (SELECT thegeom_elementi_puntuali.gid,
thegeom_elementi_puntuali.the_geom,thegeom_elementi_puntuali.uc_lege,
colate.* FROM thegeom_elementi_puntuali LEFT JOIN colate ON
thegeom_elementi_puntuali.uc_lege=colate.uc_lege) AS foo USING UNIQUE gid
USING SRID=3004'<br>
[...]<br><br>
but still the problem arises:<br><br>
<b>Fatal error</b>: [MapServer Error]: msPOSTGISLayerGetShape(): Error
executing POSTGIS SQL statement (in FETCH ALL): DECLARE mycursor2 BINARY
CURSOR FOR SELECT
&quot;gid&quot;::text,&quot;uc_lege&quot;::text,&quot;uc_lege&quot;::text,&quot;acronym&quot;::text,&quot;lava&quot;::text,&quot;interval&quot;::text,&quot;formation&quot;::text,&quot;lithosom&quot;::text,&quot;synthem&quot;::text,&quot;supersynthem&quot;::text,&quot;lithology&quot;::text,&quot;dist_morph&quot;::text,&quot;year&quot;::text,&quot;eff_rate&quot;::text,&quot;add_info&quot;::text,asbinary(force_collection(force_2d(the_geom)),'NDR')
from (SELECT
thegeom_elementi_puntuali.gid,thegeom_elementi_puntuali.the_geom,thegeom_elementi_puntuali.uc_lege,
colate.* FROM thegeom_elementi_puntuali LEFT JOIN colate ON
thegeom_elementi_puntuali.uc_lege=colate.uc_lege) AS foo WHERE gid = 71
-ERROR: column reference &quot;uc_lege&quot; is ambiguous at character 56
More Help: in <b>/var/www/apache2-default/wrift/index.php</b> on line
<b>84</b> <br><br>
Any suggestion? (and WHY DOES THIS HAPPEN??)<br><br>
Marco Foi<br><br>
<x-sigsep><p></x-sigsep>
Dip. di Scienze della Terra &quot;A.Desio&quot;<br>
Sezione di Geologia e Paleontologia<br>
<a href="http://www.gp.terra.unimi.it/" eudora="autourl">
http://www.gp.terra.unimi.it<br>
</a>Università degli Studi di Milano<br>
Via.Luigi Mangiagalli n.34 Cap.20133 Milano<br>
Laboratorio Informatico - Tel. 02- 503 15 503<br>
E-mail marco.foi@unimi.it </body>
</html>