Re: Determining if two subnets intersect

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Florian Weimer <Florian(dot)Weimer(at)RUS(dot)Uni-Stuttgart(dot)DE>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Determining if two subnets intersect
Date: 2001-07-25 06:49:26
Message-ID: 20287.996043766@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Florian Weimer <Florian(dot)Weimer(at)RUS(dot)Uni-Stuttgart(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Morgan Curley 2001-07-25 07:11:48 Inserts in triggers
Previous Message Henry House 2001-07-25 05:57:55 Re: nextval on insert by arbitrary sequence