migurski/HighRoad — Issue #4: Quantum GIS (QGIS) can't use the views
Author: NelsonMinar
Created: 2012-02-12 18:38:45+00:00
State: open

QGIS 0.7 doesn't let me use these views; apparently it requires some sort of unique key per row. The full error text it throws is below.

Here's some info on [QGIS and views](http://hub.qgis.org/wiki/quantum-gis/Using_views_with_the_postgis_provider) with suggested workarounds. Note they say "not necessary for versions 0.7 and later". My guess is QGIS finding the geometry just fine but can't find a unique ID. I tried various ways of hacking around this without much luck, but I'm a bit out of my depth here. I didn't try the OID suggestion in the linked page because my source OSM table was created without OIDs.

I don't really need High Road to work with QGIS, I was just playing around. Just filing this issue to document it.

The view 'public.planet_osm_line_z10' has no column suitable for use as a unique key.
Quantum GIS 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:
'access' derives from 'public.planet_osm_line.access' and is not suitable (type is text) and does not have a suitable constraint)
'addr:housenumber' derives from 'public.planet_osm_line.addr:housenumber' and is not suitable (type is text) and does not have a suitable constraint)
'addr:interpolation' derives from 'public.planet_osm_line.addr:interpolation' and is not suitable (type is text) and does not have a suitable constraint)
'admin_level' derives from 'public.planet_osm_line.admin_level' and is not suitable (type is text) and does not have a suitable constraint)
'aerialway' derives from 'public.planet_osm_line.aerialway' and is not suitable (type is text) and does not have a suitable constraint)
'aeroway' derives from 'public.planet_osm_line.aeroway' and is not suitable (type is text) and does not have a suitable constraint)
'amenity' derives from 'public.planet_osm_line.amenity' and is not suitable (type is text) and does not have a suitable constraint)
'area' derives from 'public.planet_osm_line.area' and is not suitable (type is text) and does not have a suitable constraint)
'barrier' derives from 'public.planet_osm_line.barrier' and is not suitable (type is text) and does not have a suitable constraint)
'bicycle' derives from 'public.planet_osm_line.bicycle' and is not suitable (type is text) and does not have a suitable constraint)
'boundary' derives from 'public.planet_osm_line.boundary' and is not suitable (type is text) and does not have a suitable constraint)
'bridge' derives from 'public.planet_osm_line.bridge' and is not suitable (type is text) and does not have a suitable constraint)
'building' derives from 'public.planet_osm_line.building' and is not suitable (type is text) and does not have a suitable constraint)
'construction' derives from 'public.planet_osm_line.construction' and is not suitable (type is text) and does not have a suitable constraint)
'cutting' derives from 'public.planet_osm_line.cutting' and is not suitable (type is text) and does not have a suitable constraint)
'disused' derives from 'public.planet_osm_line.disused' and is not suitable (type is text) and does not have a suitable constraint)
'embankment' derives from 'public.planet_osm_line.embankment' and is not suitable (type is text) and does not have a suitable constraint)
'foot' derives from 'public.planet_osm_line.foot' and is not suitable (type is text) and does not have a suitable constraint)
'highway' derives from 'public.planet_osm_line.highway' and is not suitable (type is text) and does not have a suitable constraint)
'historic' derives from 'public.planet_osm_line.historic' and is not suitable (type is text) and does not have a suitable constraint)
'horse' derives from 'public.planet_osm_line.horse' and is not suitable (type is text) and does not have a suitable constraint)
'junction' derives from 'public.planet_osm_line.junction' and is not suitable (type is text) and does not have a suitable constraint)
'landuse' derives from 'public.planet_osm_line.landuse' and is not suitable (type is text) and does not have a suitable constraint)
'layer' derives from 'public.planet_osm_line.layer' and is not suitable (type is text) and does not have a suitable constraint)
'leisure' derives from 'public.planet_osm_line.leisure' and is not suitable (type is text) and does not have a suitable constraint)
'lock' derives from 'public.planet_osm_line.lock' and is not suitable (type is text) and does not have a suitable constraint)
'man_made' derives from 'public.planet_osm_line.man_made' and is not suitable (type is text) and does not have a suitable constraint)
'military' derives from 'public.planet_osm_line.military' and is not suitable (type is text) and does not have a suitable constraint)
'motorcar' derives from 'public.planet_osm_line.motorcar' and is not suitable (type is text) and does not have a suitable constraint)
'name' derives from 'public.planet_osm_line.name' and is not suitable (type is text) and does not have a suitable constraint)
'natural' derives from 'public.planet_osm_line.natural' and is not suitable (type is text) and does not have a suitable constraint)
'oneway' derives from 'public.planet_osm_line.oneway' and is not suitable (type is text) and does not have a suitable constraint)
'operator' derives from 'public.planet_osm_line.operator' and is not suitable (type is text) and does not have a suitable constraint)
'osm_id' derives from 'public.planet_osm_line.osm_id' and is not suitable (type is int4) and does not have a suitable constraint)
'place' derives from 'public.planet_osm_line.place' and is not suitable (type is text) and does not have a suitable constraint)
'power' derives from 'public.planet_osm_line.power' and is not suitable (type is text) and does not have a suitable constraint)
'power_source' derives from 'public.planet_osm_line.power_source' and is not suitable (type is text) and does not have a suitable constraint)
'railway' derives from 'public.planet_osm_line.railway' and is not suitable (type is text) and does not have a suitable constraint)
'ref' derives from 'public.planet_osm_line.ref' and is not suitable (type is text) and does not have a suitable constraint)
'religion' derives from 'public.planet_osm_line.religion' and is not suitable (type is text) and does not have a suitable constraint)
'route' derives from 'public.planet_osm_line.route' and is not suitable (type is text) and does not have a suitable constraint)
'service' derives from 'public.planet_osm_line.service' and is not suitable (type is text) and does not have a suitable constraint)
'shop' derives from 'public.planet_osm_line.shop' and is not suitable (type is text) and does not have a suitable constraint)
'sport' derives from 'public.planet_osm_line.sport' and is not suitable (type is text) and does not have a suitable constraint)
'tourism' derives from 'public.planet_osm_line.tourism' and is not suitable (type is text) and does not have a suitable constraint)
'tracktype' derives from 'public.planet_osm_line.tracktype' and is not suitable (type is text) and does not have a suitable constraint)
'tunnel' derives from 'public.planet_osm_line.tunnel' and is not suitable (type is text) and does not have a suitable constraint)
'waterway' derives from 'public.planet_osm_line.waterway' and is not suitable (type is text) and does not have a suitable constraint)
'way' derives from 'public.planet_osm_line.way' and is not suitable (type is geometry) and does not have a suitable constraint)
'way_area' derives from 'public.planet_osm_line.way_area' and is not suitable (type is float4) and does not have a suitable constraint)
'width' derives from 'public.planet_osm_line.width' and is not suitable (type is text) and does not have a suitable constraint)
'wood' derives from 'public.planet_osm_line.wood' and is not suitable (type is text) and does not have a suitable constraint)
'z_order' derives from 'public.planet_osm_line.z_order' and is not suitable (type is int4) and does not have a suitable constraint)