Hi Raymond,

Am 26.03.2015 10:57, schrieb Raymond Nijssen:
Thanks Regis, that was exactly the issue. The (boolean!) field
'inonderzoek' was used as a key. When I change that to 'gid' in the Add
PostGIS Table dialog, everything works correctly.

Can anyone tell me why QGIS picks that boolean field for most of my
tables? Can I change that behaviour by changing my database structure?

Maybe I can, but I would need the table definition statement for it. Can you post it here. Generally speaking you should define an integer field (use bigint if you expect _many_ datasets) as primary key for the table like:

CREATE TABLE my_points
(
  gid integer NOT NULL,
  the_geom geometry(Point,my_srid),
  other_fields,
  CONSTRAINT my_points_pkey PRIMARY KEY (gid)
);

Bernhard


http://terglobo.nl/downloads/qgis_add_postgis_table_wrong_key.png

And how can the identify results be correct anyway?

Tnx,
Raymond


dbname='bag' host=localhost port=5432 user='postgres' sslmode=disable
key='inonderzoek' estimatedmetadata=true srid=28992 type=POLYGON
table="bagactueel"."pandactueelbestaand" (geovlak) sql=



On 26-03-15 10:34, Régis Haubourg wrote:
Hi, I have seen such troubles when the choosen primary key from qgis
side is
not unique .

Symptoms: selecting one feature select severals unrelated features of the
same layer. relation with attributes is broken also.

Can you check in your layer's definition (general tab of layer
properties)
if you choose gid field as key, and check if it is really unique in
postgis?

Cheers
Régis



--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/wrong-attribute-values-for-postgis-data-in-Feature-attribute-form-tp5195518p5195523.html

Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer





__________ Information from ESET Mail Security, version of virus signature 
database 11379 (20150326) __________

The message was checked by ESET Mail Security.
http://www.eset.com


_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to