André,
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 (...). The good news are: You alredy found the workaround. Alexandre Neto On Sun, Feb 2, 2014 at 10:16 PM, Giuseppe Sucameli <brush.ty...@gmail.com>wrote: > Hi André, > what QGIS and PostGIS versions are you running? > Regards. > > > On Sun, Feb 2, 2014 at 3:59 PM, ALT SHN <i.geograf...@alt-shn.org> wrote: > >> Hi list, >> >> I've been struggling with DB Manager, and I hope someone can explain me >> what the problem is. >> >> I am querying a PostGIS table but when I try to load the SELECT results >> to map canvas nothing happens! A simple example: >> >> SELECT * FROM FREGUESIAS_2013 where freguesia ILIKE 'a%' >> >> returns thos message in log winfow: >> >> *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%'* >> *) AS "subQuery_0" returned 7 [ERROR: function geometrytype(double >> precision) does not exist* >> *LINE 1: SELECT DISTINCT CASE WHEN upper(geometrytype("area_ea_ha")) ...* >> * ^* >> *HINT: No function matches the given name and argument types. You might >> need to add explicit type casts.* >> *]* >> >> Now the strange think is that if use this query as a CREATE VIEW, the >> view can be added to map canvas! Any hints? >> >> Thanks in advance, >> >> André >> >> -- >> --------------------------------------------------------------- >> >> >> *Sociedade de História Natural* >> Departamento de Informação Geográfica >> Polígono Industrial do Alto do Amial >> Pav.H02 e H06 >> >> i.geograf...@alt-shn.org <laborato...@alt-shn.org> >> www.shn.pt >> www.alt-shn.blogspot.com >> Facebook <https://www.facebook.com/SociedadeDeHistoriaNatural?ref=hl> >> >> TLM: 964138188 >> >> >> _______________________________________________ >> Qgis-user mailing list >> Qgis-user@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/qgis-user >> > > > > -- > Giuseppe Sucameli > > _______________________________________________ > Qgis-user mailing list > Qgis-user@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/qgis-user >
_______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user