Fred
thanks for help

Fred Lehodey wrote:
you can try:

1)
CREATE SEQUENCE my_seq START 1

2)
CREATE VIEW my_view AS
SELECT nextval('my_seq'), otherfield, ...
FROM mytable1, mytable2

it worked :)


CREATE SEQUENCE final_sps_elevation_seq START 1;

CREATE OR REPLACE VIEW "final_sps_elevation" (
   id,
   geom_field,
   elevation)
AS
SELECT nextval('final_sps_elevation_seq') AS id, geom_field, elevation
  FROM final_sps_s UNION ALL
  SELECT nextval('final_sps_elevation_seq') AS id, geom_field,elevation
  FROM final_sps_r;


But QGIS still complains :(

The view 'public.final_sps_elevation' 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:

'elevation' derives from 'public.final_sps_r.elevation' and is not suitable (type is float4 and does not have a suitable constraint)

'geom_field' derives from 'public.final_sps_r.geom_field' and is not suitable (type is geometry and does not have a suitable constraint)


I tried to create INDEX on VIEW but this failed.
I wonder if there is any other way to create VIEW so it can be visible in QGIS.
It is just academic as I'm using mainly Manifold.


Regards
Piotr



_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to