Skip to content
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

QGIS fails to load postgis spatial views (primary key problem) #18342

Closed
qgib opened this issue Mar 18, 2014 · 3 comments
Closed

QGIS fails to load postgis spatial views (primary key problem) #18342

qgib opened this issue Mar 18, 2014 · 3 comments
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

Comments

@qgib
Copy link
Contributor

qgib commented Mar 18, 2014

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

@qgib
Copy link
Contributor Author

qgib commented Mar 18, 2014

Author Name: Jürgen Fischer (@jef-n)


  • category_id was changed from Data Provider to Data Provider/PostGIS

@qgib
Copy link
Contributor Author

qgib commented Jun 23, 2014

Author Name: Alexandre Neto (@SrNetoChan)


Doing some fast testing to see if I can close any of my bug reports, it looks like QGIS master solves this issue. Add Postgis layer and add layer by right clicking in the Browser seams to work.

On the other hand, trying to open a Spatial View by right clicking in the DB Manager fails, giving the following errors in the Log:

"No key field view given."
"PostgreSQL layer has no primary key"

And as I stated before this was working in QGIS 2.2.

@qgib
Copy link
Contributor Author

qgib commented Jun 24, 2014

Author Name: Giovanni Manghi (@gioman)


  • resolution was changed from to worksforme
  • status_id was changed from Open to Closed

@qgib qgib added 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 labels May 24, 2019
@qgib qgib added this to the Version 2.4 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant