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

Postgis Primary key #14758

Closed
qgib opened this issue Feb 8, 2012 · 13 comments
Closed

Postgis Primary key #14758

qgib opened this issue Feb 8, 2012 · 13 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 Feb 8, 2012

Author Name: Luca Lanteri (Luca Lanteri)
Original Redmine Issue: 4969
Affected QGIS version: master
Redmine category:data_provider/postgis
Assignee: Jürgen Fischer


Hi,
with latest version of QGIS master (1.9.90.56) when I load a postGIS view select the primary key column from combobox is mandatory, whereas with previous version (surely back from 1.9.90.23), if a valid primary exists it was automatically recognized.

@qgib
Copy link
Contributor Author

qgib commented Feb 8, 2012

Author Name: Luca Lanteri (Luca Lanteri)


A possible solution may be to select the first integer valid primary key. User can also select a different field using the combobox.

@qgib
Copy link
Contributor Author

qgib commented Feb 8, 2012

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


mescal72 - wrote:

A possible solution may be to select the first integer valid primary key. User can also select a different field using the combobox.

The primary key detection wasn't really reliable before. Being a primary key in the underlying table doesn't necessarily make the columns values unique in the view - and detecting which of the integer columns are unique can be quite expensive.

What's the problem with having the user select the primary key?


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Feb 8, 2012

Author Name: Giuseppe Sucameli (@brushtyler)


Jürgen Fischer wrote:

What's the problem with having the user select the primary key?

It could be quite annoying...

Why do not pre-select the combo with the first suitable field returned by the view?
So users can define what field use as default pk for views just changing the view definition.

@qgib
Copy link
Contributor Author

qgib commented Feb 8, 2012

Author Name: Giuseppe Sucameli (@brushtyler)


Furthermore in this moment the user cannot run the query builder before he defines what's the primary key to use for the view (because the view cannot be selected if no primary key is set).

@qgib
Copy link
Contributor Author

qgib commented Feb 8, 2012

Author Name: Alessandro Ciali (Alessandro Ciali)


I don't know if it is pertaining to this issue, but from version 1.9.90.23 the OID is no more recognised as primary key for the view. Is is a bug or a wanted change?

@qgib
Copy link
Contributor Author

qgib commented Feb 8, 2012

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


fixed in d2b5ed9


  • resolution was changed from to fixed
  • status_id was changed from Feedback to Closed

@qgib
Copy link
Contributor Author

qgib commented May 11, 2012

Author Name: Giuseppe Sucameli (@brushtyler)


The problem occurs again (regression?).
The first primary key for views is not pre-selected, on Ubuntu 11.04 and QGis 1.8 d1cb3f3.


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

@qgib
Copy link
Contributor Author

qgib commented May 11, 2012

Author Name: Giuseppe Sucameli (@brushtyler)


Blocker as policy for regressions.


  • priority_id was changed from Normal to Severe/Regression

@qgib
Copy link
Contributor Author

qgib commented May 14, 2012

Author Name: Giuseppe Sucameli (@brushtyler)


The behavior was changed in 4945611 probably because if the the first suitable pkey is pre-selected the user doesn't notice the view has more pkeys.

Even though the user doesn't select any pkey from the dropdown list a view with more suitable pkeys should be selectable.
If the user loads that view w/o selecting the pkey, QGis should just use the first one in the list.

@qgib
Copy link
Contributor Author

qgib commented May 17, 2012

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


Giuseppe Sucameli wrote:

The problem occurs again (regression?).
The first primary key for views is not pre-selected, on Ubuntu 11.04 and QGis 1.8 d1cb3f3.

The mandatory selection of a primary key is intentional. QGIS just lists all integer fields without caring if they are derived from some primary key or uniquely indexed table field anymore - because that doesn't tell you anything about their uniqueness in the view anyway. The user needs to decide - QGIS will just verify that the selected key is unique (unless "use estimated table metadata" is used).

The valid bug was that @oid@ wasn't considered anymore - and that was fixed.

1.7 projects already have a @key@ field for views in their datasource uri and continue to work - so I don't consider this a regression.


  • crashes_corrupts_data was configured as 0
  • tracker_id was changed from 2 to 1
  • status_id was changed from Open to Closed
  • assigned_to_id was configured as Jürgen Fischer
  • priority_id was changed from Severe/Regression to Normal
  • resolution was changed from to fixed
  • version was configured as master

@qgib
Copy link
Contributor Author

qgib commented Jun 17, 2012

Author Name: Luca Lanteri (Luca Lanteri)


Ok, but the result is that now I must do a lot of clicks to load multiple views 'cause I have to select all single gid for every view. This is formally correct but from the user's point of view is a very annoying regression.
I really don't understand why is impossible to have the fist gid candidate as default value in the combobox. If this column is not unique a message box can prompt the user and the right column can be selected, but if the view is well structured I can save a lot of time.
It's just a piece of advice from an user.

@qgib
Copy link
Contributor Author

qgib commented Jun 17, 2012

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


  • resolution was changed from fixed to
  • status_id was changed from Closed to Reopened

@qgib
Copy link
Contributor Author

qgib commented Jun 18, 2012

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


Fixed in changeset "8eb323af13c0d949e6711eac04f553ba2e0848a8".


  • status_id was changed from Reopened 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 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