<div dir="ltr"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div style="font-size:12.8px">Hi everyone,</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I have a problem that's got me stumped.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I have the following layer defined in a mapfile:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div>LAYER</div><div><br></div><div> NAME "aggregates"</div><div> TYPE POLYGON</div><div> CONNECTIONTYPE POSTGIS</div><div> CONNECTION "host=localhost port=5432 dbname=*** user=*** password=***"</div><div> DATA "geom FROM (SELECT b.geom AS geom, a.peril_id, a.portfolio_id, a.tiv, a.thematic_tiv, a.aggregates_id FROM schema.aggregates a INNER JOIN gisdata.adm_1 b on a.gid = b.gid) AS c using SRID=4326 using unique aggregates_id"</div><div><br></div><div> PROJECTION</div><div> "proj=longlat"</div><div> "ellps=WGS84"</div><div> "datum=WGS84"</div><div> "no_defs"</div><div> END</div><div><br></div><div>END</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">This works perfectly on Mapserver 6.4, but on 7.0.5 it's failing (for what it's worth, I compiled 7.0.5 myself because my OS didn't have binary packages for it that supported php5-mapscript.) I turned on debugging and watched what kind of errors I was getting whenever I made tile requests. Here's what I found:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div>[Wed Jun 7 03:42:43 2017].502983 msDrawMap(): rendering using outputformat named png (AGG/PNG).</div><div>[Wed Jun 7 03:42:43 2017].503018 msDrawMap(): WMS/WFS set-up and query, 0.000s</div><div>[Wed Jun 7 03:42:43 2017].523359 msPostGISLayerWhichShapes(): Error (ERROR: syntax error at or near ")"</div><div>LINE 1: ...2300166285,129.462890606979 36.6292300166285))',4326) and ()</div><div> ^</div><div>) executing query: select "thematic_tiv",encode(ST_<wbr>AsBinary(ST_Force2D("geom"),'<wbr>NDR'),'hex') as geom,"aggregates_id" from (SELECT b.geom AS geom, a.peril_id, a.portfolio_id, a.tiv, a.thematic_tiv, a.aggregates_id FROM portfolios.aggregates a INNER JOIN gisdata.adm_1 b on a.gid = b.gid) AS c where geom && ST_GeomFromText('POLYGON((129.<wbr>462890606979 36.6292300166285,129.<wbr>462890606979 68.6423395678331,179.<wbr>999999974944 68.6423395678331,179.<wbr>999999974944 36.6292300166285,129.<wbr>462890606979 36.6292300166285))',4326) and ()</div><div>[Wed Jun 7 03:42:43 2017].523377 msPostGISLayerWhichShapes(): Query error. Error executing query. Check server logs</div><div>[Wed Jun 7 03:42:43 2017].523434 msDrawMap(): Image handling error. Failed to draw layer named 'area_aggregates_tiv'.</div><div>[Wed Jun 7 03:42:43 2017].523927 msFreeMap(): freeing map at 0x560aa573b6c0.</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">That "and ()" at the end of the query causing the syntax error is very strange. It's like it's adding on a blank filter. I tried making the query as simple as possible, so I created another table that contained all the required information and changed the DATA line to:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">DATA "geom from portfolios.area_aggregates_<wbr>join using SRID=4326 using unique aggregates_id"<br><br>However, I still got the same type of error. I'm completely stumped. Does anyone have an idea what could be happening? I've spent the past 4 hours Googling with no success.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thank you!</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>