<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Hi Alexandre, <br><br>On Sun, Feb 2, 2014 at 11:28 PM, Alexandre Neto <span dir="ltr"><<a href="mailto:senhor.neto@gmail.com" target="_blank">senhor.neto@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I believe that DB manager (or actually the Postgis provider to QGIS) does not like some expressions, maybe the CASE WHEN is the problem... I remember having problems with the expression WITH foo as (...).
</div></blockquote><div><br></div><div>the error message says:<i><br></i><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><i>[ERROR: function geometrytype(double precision) does not exist</i><br>
</blockquote></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>The good news are: You alredy found the workaround. <br>
</div></div></blockquote><div><br>Unfortunately that query is computed internally, into the QGIS provider, so no one can change it.<br></div><div>Even trying to load a layer by using "SELECT * FROM mytable" as query could raise such a error.<br>
<br></div><div>Regards.<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span class=""><font color="#888888"><div><br></div>
<div>Alexandre Neto</div></font></span></div><div class=""><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Feb 2, 2014 at 10:16 PM, Giuseppe Sucameli <span dir="ltr"><<a href="mailto:brush.tyler@gmail.com" target="_blank">brush.tyler@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>Hi André, <br></div>what QGIS and PostGIS versions are you running?<br></div>
<div>Regards.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Sun, Feb 2, 2014 at 3:59 PM, ALT SHN <span dir="ltr"><<a href="mailto:i.geografica@alt-shn.org" target="_blank">i.geografica@alt-shn.org</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr">Hi list,<div><br></div><div>I've been struggling with DB Manager, and I hope someone can explain me what the problem is.</div>
<div><br></div><div>I am querying a PostGIS table but when I try to load the SELECT results to map canvas nothing happens! A simple example:</div>
<div><br></div><div>SELECT * FROM FREGUESIAS_2013 where freguesia ILIKE 'a%'</div><div><br></div><div>returns thos message in log winfow:</div><div><br></div><div><div><i>Erroneous query: SELECT DISTINCT CASE WHEN upper(geometrytype("area_ea_ha")) IN ('POINT','MULTIPOINT','POINTM','MULTIPOINTM') THEN 'POINT' WHEN upper(geometrytype("area_ea_ha")) IN ('LINESTRING','MULTILINESTRING','LINESTRINGM','MULTILINESTRINGM') THEN 'LINESTRING' WHEN upper(geometrytype("area_ea_ha")) IN ('POLYGON','MULTIPOLYGON','POLYGONM','MULTIPOLYGONM') THEN 'POLYGON' END, st_srid("area_ea_ha") FROM (SELECT *, geom::geometry FROM FREGUESIAS_2013 where freguesia ILIKE 'a%'</i></div>
<div><i>) AS "subQuery_0" returned 7 [ERROR: function geometrytype(double precision) does not exist</i></div><div><i>LINE 1: SELECT DISTINCT CASE WHEN upper(geometrytype("area_ea_ha")) ...</i></div><div>
<i> ^</i></div><div><i>HINT: No function matches the given name and argument types. You might need to add explicit type casts.</i></div><div><i>]</i></div><div><br></div><div>Now the strange think is that if use this query as a CREATE VIEW, the view can be added to map canvas! Any hints?</div>
<div><br></div><div>Thanks in advance,</div><div><br></div><div>André</div><div><br></div>-- <br><div dir="ltr">---------------------------------------------------------------<br><img src="https://1.bp.blogspot.com/-tUOfxWaFyQ8/UKN4jZdmLlI/AAAAAAAAA50/mMZ01ZDGCkI/s280/Logotipo-SHN-novo-02.gif" height="102" width="200"><br>
<br><span><font color="#999999"><b>Sociedade de História Natural</b><br><font>Departamento de Informa</font></font></span><span><font color="#999999"><font><span>ção Geográfica<br></span>Polígono Industrial do Alto do Amial<br>
Pav.H02 e H06</font><br><br><a href="mailto:laboratorio@alt-shn.org" target="_blank">i.geografica<font color="#999999">@</font>alt-shn.org</a><br><a href="http://www.shn.pt" target="_blank">www.shn.pt</a><br><a href="http://www.alt-shn.blogspot.com" target="_blank">www.alt-shn.blogspot.com</a></font></span><div>
<span><font color="#999999"><a href="https://www.facebook.com/SociedadeDeHistoriaNatural?ref=hl" target="_blank">Facebook</a><br><br>TLM: <a value="+351964138188">964138188</a></font></span></div><br></div>
</div></div>
<br></div></div>_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><span><font color="#888888"><br></font></span></blockquote></div><span><font color="#888888"><br>
<br clear="all"><br>-- <br>Giuseppe Sucameli
</font></span></div></div>
<br>_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Giuseppe Sucameli
</div></div>