Был создан вид следующего содержания:
Код: Выделить всё
CREATE OR REPLACE VIEW russia_wgs AS
SELECT ST_Transform(osm_polygon.way, 4326) AS geom
FROM osm_polygon;
The view 'public.russia_wgs' has no column suitable for use as a unique key.
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:
'way' derives from 'public.osm_polygon.way' and is not suitable (type is geometry) and does not have a suitable constraint)
То есть для отображения слоя PostGIS в QGIS отображаемый вид должен иметь первичный ключ (Primary Key). Если таблица по которой формируется вид имеет первичный ключ - то просто включаем его в вид, если не имеет - то создаем и опять-таки включаем в вид.
Код: Выделить всё
CREATE OR REPLACE VIEW russia_wgs AS
SELECT osm_id, ST_Transform(osm_polygon.way, 4326) AS geom
FROM osm_polygon;