I think my question is stupid but I'm blocking. I just work with postgis ST_Line_Locate_Point function (linestring, point). to find the ends of lines. My problem is that my objects geometry type, not point. So how can I convert the geometry to geometry (point) ..?
To get identify a geometry's type use the GeometryType function.
That returns 'LINESTRING'. You can put in any geometry and it will give back the type.
Expanding on @Nicklas' and @simplexios's answers, you can use the ST_DumpPoints function to return the points of a line in order. Note that this is a set-returning function which means that it returns a set of rows formed by a geometry (given by .geom) and an array of integers (given by .path).
Edit: You can also extract the GeometryType at the same time.
That one returns:
If you want the end of line why not use ST_EndPoint
If it is all the points you want then use ST_DumpPoints
You use ST_DumpPoints like this:
to det the geometry part of the dump type.