Re: Determining if two subnets intersect - Mailing list pgsql-sql

From Tom Lane
Subject Re: Determining if two subnets intersect
Date
Msg-id 20287.996043766@sss.pgh.pa.us
Whole thread Raw
In response to Determining if two subnets intersect  (Florian Weimer <Florian.Weimer@RUS.Uni-Stuttgart.DE>)
Responses Re: Determining if two subnets intersect  (Florian Weimer <Florian.Weimer@RUS.Uni-Stuttgart.DE>)
List pgsql-sql
Florian Weimer <Florian.Weimer@RUS.Uni-Stuttgart.DE> writes:
> Is there some efficient PostgreSQL expression which is true if and
> only if two subnets (given as values of type cidr) have non-empty
> intersection (even if the intersection is not a CIDR network)?

Maybe I'm missing something, but ISTM it's only possible for two
CIDR subnets to overlap if one contains the other.  So you could
check with
    A <<= B OR B <<= A
        regards, tom lane


pgsql-sql by date:

Previous
From: Henry House
Date:
Subject: Re: nextval on insert by arbitrary sequence
Next
From: Florian Weimer
Date:
Subject: Re: Determining if two subnets intersect