I just wanna inject a comment about performance here. Using GeometryN (or ST_GeometryN) incurs a significant penalty, especially in terms of memory when i was using it. ST_Dump performs *much* better.