postgis views?

Brent Wood pcreso at PCRESO.COM
Fri Nov 10 13:53:16 EST 2006


--- Paolo Cavallini <cavallini at FAUNALIA.IT> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Thanks to all who replied.
> We had the oid on, but it did not work.
> What works for us is having a primary key.
> All the best.
> pc

Note that an oid is not (by default) indexed or a primary key. Either
specifying it as a primary key or creating a unique index on it should help.

An oid is not selected implicitly in a view (eg: select * from table). To have
the oid in the view you must select it explicitly (select oid,* from table),
which may require you to specify which oid you are including, if more than one
underlying table uses them. 

Note that in a view a unique key (including oids) from any underlying tables
may not remain unique, depending on the SQL defining the view.

Several applications which access PostGIS geometries obtain their information
from the entry in the geometry_columns table. This record is written when the
select addgeometrycolumn command is run (and is deleted by the
dropgeometrycolumn command). This record is not created when a view with
geometries is defined, which can cause problems (I'm not sure about mapserver).
In such cases manually inserting the appropriate record into this table will
help.


Cheers,

  Brent Wood



More information about the mapserver-users mailing list