Variable Substitution in Postgis Query

David Bitner osgis.lists at GMAIL.COM
Wed Feb 15 11:20:28 EST 2006


Do your filtering in PostreSQL, it will also be faster than trying to
filter with Mapserver especially if you have a two column index built
on features.type and the geometry.


Include the filter in your data statement in the mapfile:
DATA "the_geom from (SELECT * FROM features WHERE
features.type!='%ruolo%') as foo using unique [uniqueid] using
srid=[yoursrid]"

On 2/15/06, Maurizio Esposito <m.esposito at softec-srl.com> wrote:
> Hi list,
> I'm in trouble with this:
> In Mapserver CGI I use a var &ruolo=XXX set by form - all OK
> In mapfile in a Postgis layer I need to use this FILTER clause
> FILTER "pk_id NOT IN (SELECT feat_id FROM features WHERE feature.type='%
> ruolo%')"
> but substitution doesn't work.
> I've tryed all combinations of single and double quote, with or without,
> but no results at all.
> Inserting a value , say 'foo' , makes the filter work fine.
> Any help ??
>
> Regards
>
> Maurizio
>



More information about the mapserver-users mailing list