You definitely do NOT want to do this - the COLLECT() aggregate function 
doesn't gauarantee any sort of order in the points it has collected. 
Furthermore, a Multipoint object is not necessarily ordered (it will always 
list the points in the same order, but not by necessity, only because it is 
simplest). 

The best way to solve this problem is to select your list of points from the 
table (they will also need to have an "order" column in order to make sure they 
are made into a line in the correct order) and use PHP or your language of 
choice to build a new WKT string. 

HTH.

Chris

> This is an interesting question to me.  If I understand correctly, you want
> to "cast" a set of points into a linestring.  Getting your list of points
> should be as easy as:
> 
> SELECT COLLECT(the_geom) FROM mytable GROUP BY somefield.
> 
> But this returns the geometry as MULTIPOINT, which isn't really want you
> want, but if you see the text representation, it does look like a
> linestring:
> 
> SRID=-1;MULTIPOINT(596681.75 5830977.5,532989.625 5869892,547653.0625
> 5808612,608081.1875 5799629)
> 
> So can anyone else give a pointer on taking the above output and casting it
> into a linestring instead?
> 
> Tyler




