Bug report #19424

Not possible to add views from Add Layer window

Added by Saber Razmjooei almost 6 years ago. Updated over 5 years ago.

Status:Closed
Priority:Low
Assignee:-
Category:GUI
Affected QGIS version:3.3(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27252

Description

It is possible to add PostGIS views from:
  • Browser Panel
  • DB Manager

But, it is not possible to add them from Add Layer window. IMO, for the sake of consistency it should be possible to add views from there too.

Thanks
Saber

Associated revisions

Revision c225f560
Added by Martin Dobias over 5 years ago

[postgres] Fix addition of views from Data Source Manager (fixes #19424)

In order to add a PostgreSQL layer based on a view, one needs to explicitly
pick one or more columns to serve as the primary key. However in both browser
dock and in the DB manager user can add a view as a layer without specifying
primary key. Users get confused about this behavior, therefore this commit
makes the Data Source Manager behave consistently with browser and DB manager,
that is it will pick the first column as the proposed primary key automatically.

While this may be a bit risky in letting user use wrong pkey, it is very
convenient (and consistent with other part of QGIS). Also, usability of selection
of geometry type / srid / pkey column(s) is not great so it is good not to force
people to always choose pkey for their views. The list will still keep
the warning icon and tooltip shown as before.

History

#1 Updated by Martin Dobias over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF