[Qgis-developer] Postgis Spatial Views - problems with primary keys

Jürgen E. Fischer jef at norbit.de
Mon Mar 10 05:30:30 PDT 2014


Hi Alexandre,

On Mon, 10. Mar 2014 at 12:03:54 +0000, Alexandre Neto wrote:
> I then noticed that using the last method, QGIS fails to identify a good
> candidate for a primary key. Selecting it in the primary key, solves the
> problem.

QGIS just offers all integer fields as candidate.  It doesn't select any.

> Using DB Manager (add layer to canvas), QGIS sucessfully identify the
> possible primary key and everything goes well.
 
> I think this was not happening in 2.0.1. Can anyone confirm this?

I think that changed before 2.0.1. QGIS used to identify which view field are
primary keys in the underlying tables, but that makes sense if the view is a
selection of that table, which is just a very small subset of possible views.
E.g. for joins between two tables being a primary key in one of the table,
doesn't mean that the attribute is also unique in the view.


Jürgen

-- 
Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-31
Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
Software Engineer         D-26506 Norden               http://www.norbit.de
QGIS PSC member (RM)      Germany                      IRC: jef on FreeNode                         

-- 
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502



More information about the Qgis-developer mailing list