I am using ST_DumpPoints() function first to get the list of the different points in the polygon but after doing that, the first point is in one record and the third point is in another record and I don't know how to meassure the distance between them.
So I would need to have first and third points' geometry in the same record so that i can use st_distance() with both geometries.
SELECT c.id,(points).path[2] as index,(points).geom
FROM
(select
id,
ST_DumpPoints(the_geom) as points
from my_polygon_layer) as c