-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Add PostGIS layer' ignores multiple geometrytype constraint #15352
Comments
Author Name: Jürgen Fischer (@jef-n) 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". |
Author Name: Jürgen Fischer (@jef-n)
|
Author Name: anne blankert (@anneb) I did not check checkbox 'estimated table statistics' I turned on logging on the postgres database. If I remove the constraint, the following is logged: 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? 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. |
Author Name: anne blankert (@anneb) Aha, the problem seems to be caused by Postgis 2.0 view 'geometry_columns'. The problem is not a QGis bug. Issue can be closed. |
Author Name: Jürgen Fischer (@jef-n)
|
Author Name: anne blankert (@anneb)
Original Redmine Issue: 5904
Affected QGIS version: master
When opening a PostGIS database with large tables, the QGis UI displays 'detecting...' for a while and scans the tables to see what geometrytypes it contains. If more than one geometrytype has been detected in the table, the UI displays separate layers for each of the detected geometrytypes.
The detection speed is improved dramatically if a database constraint is applied to the table. This works well if the constraint checks for only one geometry type, but if you define multiple geometry types in the constraint, like:
Only the first geometry constraint is recognized by QGIS (POINT in the above example).
On inspection of the source code for the postgres dataprovider, it seems like the software is enumerating all geometrytypes from the constraint. Maybe the other geometrytypes are dropped or ignored somewhere else?
The text was updated successfully, but these errors were encountered: