Un poligono non ha un equivalente lineare diretto: anello esterno e interni vanno separati.
SELECT ST_AsText(ST_MakeLine(sp, ep)) FROM ( SELECT ST_PointN(geom, generate_series(1, ST_NPoints(geom)-1)) AS sp, ST_PointN(geom, generate_series(2, ST_NPoints(geom))) AS ep FROM ( SELECT (ST_Dump(ST_Boundary(geom))).geom FROM mypolygontable ) AS linestrings ) AS segments;