[postgis-users] Quoting column names in MapServer PostGISSupport

Dave Blasby dblasby at refractions.net
Thu May 16 12:17:31 PDT 2002


Daniel Morissette wrote:
> However, MapServer supports two types of quotes, so you might be able to
> resolve this issue by enclosing your SQL statement inside single quotes
> in the mapfile, this would allow you to use double quotes inside the SQL
> string.  I didn't test this, but I would hope that the mapfile parser is
> able to deal with that situation.
> 
> Another option might be to use single quotes instead of double quotes
> around the field names if that's supported by the PostgreSQL SQL parser.

Unfortunately, the single quote is used to define things like strings in
SQL (select * from table where name = 'dave').

What would be better would be to have the parser deal with:

	DATASET "geocolumn from \"$%#%#%^\""

On the other hand, I can just always quote things that I think are
column/table names.  Unfortunately, the DATASET can look like:
	
	DATASET "geocolumn from (SELECT * FROM table WHERE road_type = 'hwy')"

And you dont want to quote the sub-query.

The FILTER line also has the same problems:
	FILTER "length > 25"
or      FILTER "\"%@#$\" > 55"

For columns that mapserver supplies, I can check to see if they have
been pre-quoted before I auto-quote them.

dave




More information about the postgis-users mailing list