artemp/trac2github — Issue #427: Query parsing for table names fails when there is more than one table.
Author: artemp
Created: 2011-10-09 20:33:30+00:00
State: open
Labels: PostGIS_Input_Driver

I have a mapfile with this query in it:

{{{
(SELECT *,
REGEXP_REPLACE(UPPER(name), '(.)', E'\\1\xC2\xA0\xC2\xA0', 'g') AS name_stretched,
COALESCE(z_order, 0) AS coalesced_z_order,
(CASE WHEN place = 'city' THEN 0
WHEN place = 'town' THEN 1
WHEN place = 'village' THEN 2
ELSE 3 END) AS priority
FROM osm_point
WHERE place IN ('city', 'town', 'hamlet', 'village')
AND name NOT IN (SELECT name FROM model_app_location)
ORDER BY priority ASC, coalesced_z_order DESC
) AS places
}}}

This will fail because the postgis driver attempts to use the last table name mentioned in a query as the source of the geometry column, and I want to use osm_point rather than model_app_location.