Constraint to prevent overlapping ranges in an array field in PostgreSQL
I had a similar problem with an array of int4ranges, and solved it (so far to my satisfaction) by writing this for WiTopia who has kindly agreed to let me share. Please satisfy yourself it works before using it in production -- I am still doing that!

CREATE OR REPLACE  FUNCTION overlapping(therange int4range[])
RETURNS BOOLEAN as
$$
BEGIN

        RETURN (
                with  
                      t1 as (select unnest(therange) as lefthand),
                      t2 as (select unnest(therange) as righthand)
                select (select array_length(therange, 1)) !=
                       (select count(*) from t1, t2 where t1.lefthand &amp;&amp; t2.righthand)

       );

END;
$$ LANGUAGE plpgsql


I do a &amp;&amp; (overlap) based join with the array and itself.   Each item will join with itself, and should join with any other item it overlaps as well, so the count of the result of the &amp;&amp;-join would be greater than the count of the original array if there are overlapping items.   If there are only non-overlapping items, then each item will join with itself only, and the result of the join will have one row for each element in the original array.

I'd be careful about using this once the arrays got big -- it's N^2 in concept!

After defining this function, I put this constraint in:

check (portsegments is null or not overlapping(portsegments))