[mapserver-users] Postgres SQL oddity . . .
Basques, Bob (CI-StPaul)
bob.basques at ci.stpaul.mn.us
Mon Dec 15 14:07:31 PST 2014
Vname is NOT distinct in the data table.
I got the SQL to pass by dropping the " * " from the SQL, but ran into a different problem, how to run a logical expression against a POSTGRES call, looks like it only works with SHP files. Crap!!
Bobb
From: Rahkonen Jukka (Tike) [mailto:jukka.rahkonen at mmmtike.fi]
Sent: Monday, December 15, 2014 4:01 PM
To: Basques, Bob (CI-StPaul); mapserver-users at osgeo.org
Subject: Re: Postgres SQL oddity . . .
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<http://www.opengis.net/ogc%20http:/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/bec90a34/attachment.htm>
More information about the MapServer-users
mailing list