https://issues.qgis.org/https://issues.qgis.org/favicon.ico2012-06-29T08:54:13ZQGIS Issue TrackingQGIS Application - Bug report #5904: 'Add PostGIS layer' ignores multiple geometrytype constrainthttps://issues.qgis.org/issues/5904?journal_id=331032012-06-29T08:54:13ZJürgen Fischerjef@norbit.de
<ul></ul><p>The constraint aren't inspected at all. The geometry type of the geometries in the table are. If you are using "use estimated meta data" only a few geometries are inspected, if those don't happen to be of all geometry types, that are in the table, the list will be incomplete. So I suspect that you're using "use estimated meta data".</p> QGIS Application - Bug report #5904: 'Add PostGIS layer' ignores multiple geometrytype constrainthttps://issues.qgis.org/issues/5904?journal_id=331042012-06-29T08:54:43ZJürgen Fischerjef@norbit.de
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Feedback</i></li></ul> QGIS Application - Bug report #5904: 'Add PostGIS layer' ignores multiple geometrytype constrainthttps://issues.qgis.org/issues/5904?journal_id=331092012-06-29T12:27:35Zanne blankertanne.blankert@geodan.nl
<ul></ul><p>I did not check checkbox 'estimated table statistics'</p>
<p>I turned on logging on the postgres database.</p>
<p>If I remove the constraint, the following is logged:<br />SELECT DISTINCT CASE WHEN upper(geometrytype("geom")) IN ('POINT','MULTIPOINT','POINTM','MULTIPOINTM') THEN 'POINT' WHEN upper(geometrytype("geom")) IN ('LINESTRING','MULTILINESTRING','LINESTRINGM','MULTILINESTRINGM') THEN 'LINESTRING' WHEN upper(geometrytype("geom")) IN ('POLYGON','MULTIPOLYGON','POLYGONM','MULTIPOLYGONM') THEN 'POLYGON' END, st_srid("geom") FROM "myschema"."mytable"</p>
<p>If I restore the constraint, the above query is not logged (verified twice) and there is no 'Detecting...' message for the table. It seems QGis thinks there is a shortcut, probably by inspecting the database meta tables?</p>
<p>I was looking at the source code of the postgres provider and there is a query using column consr from table pg_constraint in the pg_catalog, but according to the database log, the pg_constraint query is not used.</p> QGIS Application - Bug report #5904: 'Add PostGIS layer' ignores multiple geometrytype constrainthttps://issues.qgis.org/issues/5904?journal_id=331102012-06-29T12:32:54Zanne blankertanne.blankert@geodan.nl
<ul></ul><p>Aha, the problem seems to be caused by Postgis 2.0 view 'geometry_columns'.<br />The view somehow takes into account the geometry constraints and sets the 'type' to the first type mentioned in the constraint.</p>
<p>The problem is not a QGis bug. Issue can be closed.</p> QGIS Application - Bug report #5904: 'Add PostGIS layer' ignores multiple geometrytype constrainthttps://issues.qgis.org/issues/5904?journal_id=331112012-06-29T12:35:44ZJürgen Fischerjef@norbit.de
<ul><li><strong>Resolution</strong> set to <i>worksforme</i></li><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Closed</i></li></ul>