[postgis-users] Querying map layer based on a view

Stephen Woodbridge woodbri at swoodbridge.com
Wed Jun 28 05:58:19 PDT 2006


Dave Stone wrote:
> I'm seeking advice on how to set up a view in PostgreSQL so that a layer 
> based on it can be queried in MapServer by clicking the map.
> 
> I've got a spatial table S and a number of other non-spatial tables 
> which I want to join in the view, so that attributes from all of them 
> can be included in the result-set.
> 
> If I set up a layer based solely on S, then I use the syntax 'using 
> unique oid' and everything is fine. When S is joined to the other 
> tables, however, oid will not uniquely identify a result record.
> 
> Is it permissible to put 'using unique oid, key2' where key2 is the 
> primary key from a non-spatial table, and oid and key2 between them 
> uniquely identify a result record?

Why not add a unique column to the view then you can reference that in 
"using unique mycol"

-Steve



More information about the postgis-users mailing list