[postgis-users] MapServer subquery problem

strk at refractions.net strk at refractions.net
Mon Aug 29 04:20:06 PDT 2005


Make this change in you DATA string:

-	from(SELECT ...
+	from (SELECT ...

--strk;

On Mon, Aug 29, 2005 at 01:50:29PM +0300, Geodata Analysis wrote:
> Hi List,
> 
> I'm trying to add a layer from postgis in my mapfile but i get the 
> following error :
> 
> *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 
> from(SELECT table1.the_geom AS the_geom)),'NDR'),gid::text from table1, 
> table2 WHERE distance(table1.the_geom, table2.the_geom) < 1000) as foo 
> WHERE the_geom from(SELECT table1.the_geom AS the_geom && 
> setSRID('BOX3D(742438.212 4108421.689,759685.98 4121357.515)'::BOX3D, -1 )'
> 
> Postgresql reports the error as 'ERROR: syntax error at or near "from" 
> at character 87 '
> 
> the line in my mapfile is :
> DATA        "the_geom from(SELECT table1.the_geom AS the_geom FROM 
> table1, table2 WHERE distance(table1.the_geom, table2.the_geom) < 1000) 
> as foo using unique gid using srid=-1"
> 
> 1. I've tried a lot variations
> 2. If I declare the layer without the subquery, all the data is 
> displayed correctly.
> 3. If I execute the query : select the_geom from(SELECT table1.the_geom 
> AS the_geom FROM table1, table2 WHERE distance(table1.the_geom, 
> table2.the_geom) < 1000) as foo in phppgadmin, I get the correct results
> 
> Any ideas ?
> Thank you
> 
> Stathis Stergou
> Gis Programmer
> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list