[Qgis-user] Help to load a postgis view on QGIS : primary key required

Lore M tchibadou at hotmail.com
Fri Sep 25 07:59:28 PDT 2009


Thanks it works now !
I just have to define gid as a primary key in the table used to create the view...even if I would prefer to have several attributes as one primary key.
(Just to know, I also tried, as Remco Houtkamp said, with Quantum Gis 1.3 (Mimas) via osg4w but it doesn't work.)
Thanks again !

> Date: Fri, 25 Sep 2009 11:40:24 +0200
> From: Bernhard.Stroebl at jena.de
> To: qgis-user at lists.osgeo.org
> Subject: Re: [Qgis-user] Help to load a postgis view on QGIS : primary key	required
> 
> Hi Lore,
> 
> AFAIK you _must_ define the gid field as a primary key in your base 
> table, it does not matter if it can be considered to be one.
> 
> ALTER TABLE calendrier_activite ADD PRIMARY KEY (gid);
> 
> Bernhard
> 
> Lore M schrieb:
> > Hi 
> > 
> > I have kind of an ordinary (but still thorny) problem with Qgis (version 1.0.2kore) when I try to load a postgis layer. I'm sorry because there is several posts about this problem but neither of the solutions proposed solve my own problem...
> > 
> > So, I've got two tables in my postgreSQL database and I create a view from them.
> > 
> > -- View: calendrier_area
> > CREATE OR REPLACE VIEW calendrier_area AS 
> >  SELECT calendrier_activite.gid, calendrier_activite.annee, calendrier_activite.mois, calendrier_activite.navire_code, calendrier_activite.zone, ciem_areas.ices_area, ciem_areas.the_geom
> >    FROM calendrier_activite, ciem_areas
> >   WHERE "substring"(calendrier_activite.zone::text, 1, 4) = "substring"(ciem_areas.ices_area::text, 1, 4);
> > ALTER TABLE calendrier_area OWNER TO postgres;
> > 
> > The attribute "gid" from the table "calendrier_activite" is UNIQUE (I check this with "SELECT DISTINCT * FROM calendrier_area;" and there is as many lines as in table "SELECT * FROM calendrier_area"). Moreover, "gid" type is "serial" so "int4". Therefore, calendrier_area.gid can be considered as a PRIMARY KEY in the view.
> > 
> > For all that, I can't load this view in Qgis : it still ask me for PRIMARY KEY in the view calendrier_area.
> > 
> > Do you any idea please ??? Thanks everyone
> > 
> > Lore
> >  
> >  		 	   		  
> > _________________________________________________________________
> > Découvrez toutes les possibilités de communication avec vos proches
> > http://www.microsoft.com/windows/windowslive/default.aspx
> > 
> > ________ Information from NOD32 ________
> > This message was checked by NOD32 Antivirus System for Linux Mail Server.
> > http://www.nod32.com
> > 
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > _______________________________________________
> > Qgis-user mailing list
> > Qgis-user at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-user
> > 
> > 
> > ________ Information from NOD32 ________
> > This message was checked by NOD32 Antivirus System for Linux Mail Server.
> > http://www.nod32.com
> 
> -- 
> Dipl.-Geogr. Bernhard Ströbl
> Anwendungsbetreuer GIS
> Kommunale Immobilien Jena
>   - Datenverarbeitung -
> mailto:Bernhard.Stroebl at jena.de
> http://kij.jena.de/
> ----------------------------
> 
> 
> ________ Information from NOD32 ________
> This message was checked by NOD32 Antivirus System for Linux Mail Server.
> http://www.nod32.com
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
 		 	   		  
_________________________________________________________________
Inédit ! Des Emoticônes Déjantées! Installez les dans votre Messenger !
http://www.ilovemessenger.fr/Emoticones/EmoticonesDejantees.aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20090925/b8757078/attachment.html>


More information about the Qgis-user mailing list