[Qgis-user] Can't load PostGIS views

Mathieu Ouellette ouellette.mathieu at gmail.com
Fri Nov 18 08:31:09 PST 2011


Hi,

I have a PostGIS database and I'm trying to load some views in QGIS 1.7 but
it doesn't work. The error message title is in French but basically it says
that QGIS can't find an appropriate primary key. The message regarding the
column which would normally acts as a primary key is in French again but it
says that is not suitable because its type is int4 and it doesn't have
constraints.

However, this column has a primary key constraint in the base table, has a
unique constraint and is set to NOT NULL... I also created a test view in
which the select query is identical to the base table (no joins, no alias,
...) and the same error happens (while the base table is loading
perfectly). In order to push further, I made a SELECT DISTINCT query on my
id column and a SELECT COUNT(DISTINCT my_id_column) on both the base table
and the test view and I got the same numbers so the values of this column
are really unique. I also loaded my views in uDig and I got no problem.

Does anybody have any idea on what could be causing this problem?

Thanks a lot,

Mathieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20111118/fcbdbc76/attachment.html>


More information about the Qgis-user mailing list