Variable Substitution in Postgis Query

David Bitner osgis.lists at GMAIL.COM
Thu Feb 16 10:57:42 EST 2006


In your data definition, try:
data "the_geom from (select * from buildings where buildings.pk_id NOT
IN (SELECT feat_id FROM feat_vis WHERE feat_vis.ruolo='%ruolo%' AND
feat_vis.layer='buildings')) using unique oid using srid=-1"

Make sure to substitute in your actual srid and a unique id where I've put oid.

Also, if this doesn't work, send us the output from the error page
that you get from mapserver.  In that error page there will be a whole
section that includes the actual query that was used against PostGIS
that includes the variable substitution.

David

On 2/16/06, Maurizio Esposito <m.esposito at softec-srl.com> wrote:
> Ciao Umberto
> hi list
> this is the query where substitution doesn't work:
>
> DATA "the_geom from buildings"
> FILTER "buildings.pk_id NOT IN (SELECT feat_id FROM feat_vis WHERE
> feat_vis.ruolo='%ruolo%' AND feat_vis.layer='buildings')"
>
> The table feat_vis is used as an exclusion list with the following
> attributes:
> ruolo
> layer
> feat_id
>
> and if I substitute %ruolo% with a string value, i.e. 'technician' the
> query works fine
>
> Thank you
>
> Maurizio
>



More information about the mapserver-users mailing list