<html><body>
<p>Hi all,<br>
<br>
I have a PostGIS layer with multiple geometries: POINT, MULTIPOINT, LINESTRING and MULTILINESTRING.<br>
<br>
I tried to add a layer in this way:<br>
<br>
  uri = QgsDataSourceURI()<br>
  uri.setConnection (&quot;cartografia&quot;, &quot;5432&quot;, &quot;schema&quot;, &quot;postgres&quot;, &quot;pppp&quot;)<br>
  uri.setSql (&quot;sql=GeometryType('wkb_geometry') IN ('LINESTRING','MULTILINESTRING')&quot;) <br>
  self.iface.addVectorLayer (uri.uri(), tab, &quot;postgres&quot;)<br>
<br>
but QGIS complains that it cannot add GEOMETRY types. How can threat this layer as LINESTRING ?<br>
<br>
</body></html>