[Qgis-user] postgis layer from a view

2010-06-01 Thread Lionel Roubeyrie
Hi all, I can't load datas from a postgis view, the loader complains about no uniques values and int4 type, however the view starts with SELECT nextval('my_seq'::regclass)::integer AS gid, com.the_geom, ... (the gid column is not listed in the error message) which works perfectly if datas are

Re: [Qgis-user] postgis layer from a view

2010-06-01 Thread Bernhard Ströbl
Dear Lionel, AFAIK the view must contain a field being defined as primary key in the underlying table, moreover this field must be of type integer. The view must be defined in a way that every element (thus every primary-key value) is unique. In case the view contains a join resulting in

Re: [Qgis-user] postgis layer from a view

2010-06-01 Thread Lionel Roubeyrie
Hi Bernhard, thanks to responding. I have modified the view to retrieve the gid column form a table, which is a primary key with unique values, and not from a sequence, but postgis provider complains again about no unique values oO Here is the table : CREATE TABLE spatial.commune ( code_insee

Re: [Qgis-user] postgis layer from a view

2010-06-01 Thread Bernhard Ströbl
Dear Lionel, I guess the problem is that you join spatial.commune at residentiel.nrj_sourcesfixes. If this is a n:1 or n:m - join, gids appear several times, thus gid is not unique (postgis provider tells you). Try using residentiel.nrj_sourcesfixes' (or one of its underlying tables')

[Qgis-user] Re:postgis layer from a view

2010-06-01 Thread Andrea Peri 2007
Hi Lionel, try a query like this: select count(gid) from view group by gid having count(gid)1 to see if there is some duplicates. Regards, Andrea. ___ Qgis-user mailing list Qgis-user@lists.osgeo.org