[mapserver-users] Postgres SQL oddity . . .
Rahkonen Jukka (Tike)
jukka.rahkonen at mmmtike.fi
Mon Dec 15 14:00:41 PST 2014
Hi,
If vname is unique in your table, why do you need to do "select distinct" on it?
I would make a blind guess with an alias name select distinct on (vname) vname_distinct
Usually it is not as easy, though
-Jukka Rahkonen-
________________________________
Basques, Bob wrote:
> I'm trying to display a set of GPS points from a layer in Postrgres . . .
> Getting this error however:
<ServiceExceptionReport version="1.3.0" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd"><ServiceException>
msDrawMap(): Image handling error. Failed to draw layer named 'AVL_Plot_00to96'.
msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR: column reference "vname" is ambiguous
LINE 1: select "elapsed_min","vname",encode(ST_AsBinary(ST_Force2D("...
</ServiceException></ServiceExceptionReport>
from this Call:
DATA "the_geom from (
select
distinct on (vname) vname,
st_length(st_transform(the_line, 26993)) as feet,
(DATE_PART('day', now() - acqtime) * 24 +
DATE_PART('hour', now() - acqtime) * 60 +
DATE_PART('minute', now() - acqtime)
) as elapsed_min, -- Compiled minutes since last major move of asset.
*
from
loc
where
st_length(st_transform(the_line, 26993)) > 30 -- GPS error
order by
vname desc
) as subquery using unique vname using srid=200068"
What I don't understand is how VNAME can be ambiguous when calling only one table (loc)?? The SQL works fine in PGADMIN. Does the using unique vname have something to do with the problem, which seems to be required.
Help??
Thanks.
bobb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20141215/756cb90d/attachment.htm>
More information about the MapServer-users
mailing list