[postgis-users] no union allowed in update?

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Thu Jul 15 07:52:14 PDT 2010


ST_Union is an aggregate function that you must use with a GROUP BY clause. Here, you are not agregating anything.

Pierre

>-----Original Message-----
>From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-
>bounces at postgis.refractions.net] On Behalf Of Biddy
>Sent: 15 juillet 2010 09:37
>To: postgis-users at postgis.refractions.net
>Subject: [postgis-users] no union allowed in update?
>
>Hi everyone,
>
>I am trying to do the following in plpgsql:
>
>UPDATE lidarmpts set latlongalt =
>ST_Union(ST_GeomFromEWKT('SRID=4326;MULTIPOINT(' || lidarline.latitude
>|| ' ' || lidarline.longitude || ' ' || lidarline.elevation || ')' ))
>WHERE lidarline.rawlidarpts_id = counter;
>
>The error I get is like:
>
>ERROR:  cannot use aggregate function in UPDATE
>LINE 1: UPDATE lidarmpts set latlongalt = ST_Union(ST_GeomFromEWKT('...
>                                           ^
>QUERY:  UPDATE lidarmpts set latlongalt =
>ST_Union(ST_GeomFromEWKT('SRID=4326;MULTIPOINT(' ||  $1  || ' ' ||  $2
>  || ' ' ||  $3  || ')' )) WHERE  $4  =  $5
>CONTEXT:  PL/pgSQL function "fill_multipoint" line 10 at SQL statement
>
>Now, the thing is that I had this snipped of code from before when I
>did stuff in Java and it was working perfectly fine.
>However, now in plpgsql it has decided that I cannot do unions anymore
>in an update.
>
>What's behind this?
>How can I still update my multipoint?
>
>All help is greatly appreciated,
>cheers,
>B.
>
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list