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

Add PostGIS view -- primary key is ignored #22769

Closed
qgib opened this issue May 13, 2016 · 5 comments
Closed

Add PostGIS view -- primary key is ignored #22769

qgib opened this issue May 13, 2016 · 5 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

Comments

@qgib
Copy link
Contributor

qgib commented May 13, 2016

Author Name: Thomas Kandler (Thomas Kandler)
Original Redmine Issue: 14813
Affected QGIS version: 2.14.0
Redmine category:data_provider


When loading a PostGIS view with a primary key, the key should be choosen automatically (by using the first column I guess). In QGIS 2.8 this was possible, since 2.12 the function does not exist anymore. Maybe it is a deliberate change to avoid errors when loading a layer which turns out to have non-unique values in this column. Maybe it is a bug. In the first case, I'd second #22350

This affects views with an unique integer column (+ all other columns are string-type) as well as views with a singular string column (+ geom column).


@qgib
Copy link
Contributor Author

qgib commented May 13, 2016

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


The arbitray pre-selection of the first column is gone. You are now required to select the primary keys (one or more columns).

@qgib
Copy link
Contributor Author

qgib commented May 13, 2016

Author Name: Thomas Kandler (Thomas Kandler)


Jürgen Fischer wrote:

The arbitray pre-selection of the first column is gone. You are now required to select the primary keys (one or more columns).

Any rationale for this? I am just wondering since even a arbitrary selection would be as efficient as the mandatory selection at worst; and in many cases more efficient since I save 2 clicks per layer/view.

P.S. Issue can be closed; I will do asap.

@qgib
Copy link
Contributor Author

qgib commented May 13, 2016

Author Name: Thomas Kandler (Thomas Kandler)


  • status_id was changed from Open to Closed

@qgib
Copy link
Contributor Author

qgib commented May 15, 2016

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


Thomas Kandler wrote:

Jürgen Fischer wrote:

The arbitray pre-selection of the first column is gone. You are now required to select the primary keys (one or more columns).

Any rationale for this? I am just wondering since even a arbitrary selection would be as efficient as the mandatory selection at worst; and in many cases more efficient since I save 2 clicks per layer/view.

QGIS doesn't know what the unique column is and was always supposed to be selected. The preselection was hiding this and led to reports of strange effects when it wasn't unique.

@qgib
Copy link
Contributor Author

qgib commented May 15, 2016

Author Name: Thomas Kandler (Thomas Kandler)


Jürgen Fischer wrote:

QGIS doesn't know what the unique column is and was always supposed to be selected. The preselection was hiding this and led to reports of strange effects when it wasn't unique.

Thank you very much for the clarification. I'd taken another approach but I am also not a contributing dev. Anyhow, I guess #22350 could be a well worth investment for folks who have a lot of PostGIS views (spanning multiple DBs) in their everyday work.

@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 25, 2019
@qgib qgib closed this as completed May 25, 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