Received: from mercury.rus.uni-stuttgart.de (mercury.rus.uni-stuttgart.de [129.69.1.226]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6P826f77522 for ; Wed, 25 Jul 2001 04:02:06 -0400 (EDT) (envelope-from Florian.Weimer@RUS.Uni-Stuttgart.DE) Received: from rusfw by mercury.rus.uni-stuttgart.de with local (Exim 3.22 #1) id 15PIv5-00006P-00; Wed, 25 Jul 2001 09:17:23 +0200 To: Tom Lane Cc: pgsql-sql@postgresql.org Subject: Re: Determining if two subnets intersect References: <20287.996043766@sss.pgh.pa.us> From: Florian Weimer Date: 25 Jul 2001 09:17:23 +0200 In-Reply-To: <20287.996043766@sss.pgh.pa.us> (Tom Lane's message of "Wed, 25 Jul 2001 02:49:26 -0400") Message-ID: Lines: 19 User-Agent: Gnus/5.090001 (Oort Gnus v0.01) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200107/333 X-Sequence-Number: 4146 Tom Lane writes: > Florian Weimer 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.Weimer@RUS.Uni-Stuttgart.DE University of Stuttgart http://cert.uni-stuttgart.de/ RUS-CERT +49-711-685-5973/fax +49-711-685-5898