ST_ExteriorRing — Returns a LineString representing the exterior ring of a Polygon.
geometry ST_ExteriorRing(geometry  a_polygon);
Restituisce una LINESTRING che rappresenta l'anello esterno per una geometria POLYGON. Restituisce NULL se la geometria non è un poligono. Non funziona con MULTIPOLYGON
                 
               | 
              |
| 
                 Non funzionerà per i MULTIPOLYGON. Da utilizzare assieme a ST_GeometryN o ST_Dump per i MULTIPOLYGON  | 
            
            
 Questo metodo implementa le OGC Simple Features Implementation Specification for SQL 1.1.  2.1.5.1
            
 Questo metodo implementa la specifica SQL/MM.  SQL-MM 3: 8.2.3, 8.3.3
            
 Questa funzione supporta il 3d e non distrugge gli z-index. 
--If you have a table of polygons
SELECT gid, ST_ExteriorRing(geom) AS ering
FROM sometable;
--If you have a table of MULTIPOLYGONs
--and want to return a MULTILINESTRING composed of the exterior rings of each polygon
SELECT gid, ST_Collect(ST_ExteriorRing(geom)) AS erings
        FROM (SELECT gid, (ST_Dump(geom)).geom As geom
                        FROM sometable) As foo
GROUP BY gid;
--3d Example
SELECT ST_AsEWKT(
        ST_ExteriorRing(
        ST_GeomFromEWKT('POLYGON((0 0 1, 1 1 1, 1 2 1, 1 1 1, 0 0 1))')
        )
);
st_asewkt
---------
LINESTRING(0 0 1,1 1 1,1 2 1,1 1 1,0 0 1)