3

I have a PostGIS database with various tables and views. With pgAdmin I can make requests on the tables, on the views, all is working. I add tables in QGIS 2.8, it's working, I can read, write, modify the data. I can add views in QGIS, for all of them except two, it works. For two views, a QGIS error window says the layer "is an invalid layer and cannot be loaded".

But I have tested on pgAdmin, the views are good and quick the load data.

So I modify the views with :

ADD OR REPLACE VIEW x AS (/*SQL code*/ LIMIT 10);

And now I can add the views in qGIS, and it works.

I modify the views to remove the LIMIT 10. And in qGIS I can see the views and ask informations about entities, all is good.

But if I save the QQIS project, on restart the layer fails to load.

I think the problem is in QGIS. But how can I know how QGIS checks all the shapes, I can solve the problem.

  • 1
    Have you checked gis.stackexchange.com/questions/25699/…, especially the part about unique integer id column? Try QGIS 2.10 which should not require this unique integer id. – underdark Sep 19 '15 at 15:37
  • 2
    Can you please post the actual SQL in the CREATE VIEW statement? – Lee Hachadoorian Sep 20 '15 at 14:00
  • Are you sure your query returns only one type of geometries? – Alexandre Neto Jan 15 '18 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.