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.