[Qgis-user] unique id in postgis layer

Ľubomír Varga luvar at plaintext.sk
Sun Oct 19 14:41:40 PDT 2008


Hi.

Iam new in using qgis. I have problem to display data from my postgis enabled 
database in postgre. I have table with this definition:

CREATE TABLE t_positions
(
  id bigint NOT NULL,
  "line" geometry
)

Is it posible to view data from this table vitw bigint id type in qgis?

I have tried view like this:

select id::int4 as id, location from t_position;

qgis ignored type in view. Instead of it it took type from original table, 
which is bigint and delivered me this error:

The view 'public.qgis_route' has no column suitable for use as a unique key.

<message>
Qgis requires that the view has a column that can be used as a unique key. 
Such a column should be derived from a table column of type int4 and be a 
primary key, have a unique constraint on it, or be a PostgreSQL oid column. 
To improve performance the column should also be indexed.

The view you selected has the following columns, none of which satisfy the 
above conditions:
'id' derives from 'public.t_positions.id' and is not suitable (type is int8 
and has a suitable constraint)
'line' derives from 'public.t_positions.line' and is not suitable (type is 
geometry and does not have a suitable constraint)
</message>


So simple question: How to display postgis table with bigint key in qgis?



More information about the Qgis-user mailing list