[QGIS-trac] [Quantum GIS] #1417: Unable to add a Postgis layer when the key attribut have an alias

Quantum GIS qgis at qgis.org
Fri Nov 21 05:01:35 EST 2008


#1417: Unable to add a Postgis layer when the key attribut have an alias
------------------------------------------------+---------------------------
   Reporter:  mgrizonnet                        |              Owner:  nobody       
       Type:  bug                               |             Status:  new          
   Priority:  major: does not work as expected  |          Milestone:  Version 1.0.0
  Component:  Data Provider                     |            Version:  HEAD         
   Keywords:  postgis layer/primary key/alias   |   Platform_version:               
   Platform:  Windows                           |           Must_fix:  No           
Status_info:  0                                 |  
------------------------------------------------+---------------------------
 I created 2 views  VIEW _VIEW0 and VIEW _VIEW1 in PostgreSQL.

 The code:

 {{{
 CREATE OR REPLACE VIEW _VIEW0 AS
 SELECT
 t1.geom,
 t1.id
 FROM table1 t1
 ORDER BY t1.id;
 }}}



 {{{
 CREATE OR REPLACE VIEW _VIEW0 AS
 SELECT
 t1.geom,
 t1.id as id_geo
 FROM table1 t1
 ORDER BY t1.id;
 }}}

 It is the same views. The only difference is that the attribute "id" has
 got an "alias" (the alias is "id_geo").
 The data type of id is int4 and it is a primary key (needed by QGIS to
 make the connection).

 The first view works well but not the second. The message returned by QGIS
 is that the attribute "id" is not a primary key (data not unique).

 But it is the same views!!!!

-- 
Ticket URL: <https://trac.osgeo.org/qgis/ticket/1417>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list