Re: Determining if two subnets intersect

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

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> 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

Oh, I think you are right; I haven't paid attention. Thanks.

--
Florian Weimer Florian(dot)Weimer(at)RUS(dot)Uni-Stuttgart(dot)DE
University of Stuttgart http://cert.uni-stuttgart.de/
RUS-CERT +49-711-685-5973/fax +49-711-685-5898

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2001-07-25 08:56:35 Re: Inserts in triggers
Previous Message Morgan Curley 2001-07-25 07:12:20 Inserts in triggers