Skip to content
This repository has been archived by the owner on Jun 4, 2020. It is now read-only.

gid should be the first column in views (not geom) #68

Closed
kadarivan opened this issue Jun 21, 2017 · 5 comments
Closed

gid should be the first column in views (not geom) #68

kadarivan opened this issue Jun 21, 2017 · 5 comments

Comments

@kadarivan
Copy link

QGIS failed to recognise the private key of view if the geom is the first column. So I can't add layer from QGIS Browser or DB Manager.
(I can add the layer with Add PostGIS Layers button, but in this case, I must select the private key every time manually)

@gignacnic
Copy link
Contributor

This is QGIS limitation, but not related to the plugin. What you can do and I have done it and test it successfully, it is to update in PgAdmin this view by reordering fields in the SELECT.
You just have to update by replacing the view created by the plugin in the trunk schema and reorder default fields and placing unique_id as the first column:
CREATE OR REPLACE VIEW trunk_rev_head.view_name WITH (security_barrier=true) AS
SELECT table_name.name_of_your_unique_id_field, table_name.geom, ....

@kadarivan
Copy link
Author

Thanks, i did it. But it means, that I must do it with all my colleges' PGcheckout shemas.
I hoped, it could be changed in the plugin. The plugin should not reverse the columns order, when historize the schema, creating the rev_head or new PGcheckout...

@gignacnic
Copy link
Contributor

You do not have to do it for all PG checkout. Once it is done in the trunk schema, every time someone will do a PG checkout afterward, it will use columns order from the trunk view in the checkout.

@kadarivan
Copy link
Author

For me, the checkout reverse the columns order (QGIS 2.14.15 LTR, versioning 0.8, PG 9.6, PGIS 2.3.2)

And the CREATE OR REPLACE VIEW... is not working, I must delete the views first: https://www.postgresql.org/docs/9.6/static/sql-createview.html

@SebastienPeillet
Copy link

Project migrated to : https://gitlab.com/Oslandia/qgis/qgis-versioning

@delhomer delhomer closed this as completed Jun 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants