Please consider adding a midpoint attribute to the ST_GEOMETRY datatype (and a MIDPOINT accessor function).
Otherwise, it is unnecessarily difficult to calculate the midpoint of a line using SQL/ST_GEOMETRY.
Please note that the midpoint should be the true midpoint: half of the distance along the polyline (not the middle vertex, which would not be the true midpoint).
Thank you.