QGIS fails to load postgis spatial views (primary key problem) #18342
Labels
Bug
Either a bug report, or a bug fix. Let's hope for the latter!
Data Provider
Related to specific vector, raster or mesh data providers
Milestone
Author Name: Alexandre Neto (@SrNetoChan)
Original Redmine Issue: 9803
Affected QGIS version: 2.2.0
Redmine category:data_provider/postgis
Since QGIS 2.2, adding a postgis spatial view using the browser throws the following error:
"The layer dbname='postgis' host=192.168.100.7 port=5432 user='postgres' password='postgres' sslmode=disable key='cadeado' srid=3763 type=POINT table="PGHP"."infra_portoes" (geom) sql= is not a valid layer and can not be added to the map"
Adding the spatial view using the "add postgis layer", the layer is added but with the wrong primary key, resulting in odd behaviors. Selecting a good primary key in the primary key column, solves the problem.
Using DB Manager (add layer to canvas), QGIS successfully identifies the a possible primary key and everything goes well.
Despite Jürgen's opinion[1], IMHO this situation is not optimal, breaks the browser usability and can be considered a step back. Obviously, I do not know if there are any other technical implications to this.
"[1]":http://osgeo-org.1560.x6.nabble.com/Postgis-Spatial-Views-problems-with-primary-keys-td5128067.html
The text was updated successfully, but these errors were encountered: