Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6P6nqf15104 for ; Wed, 25 Jul 2001 02:49:52 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f6P6nRC20290; Wed, 25 Jul 2001 02:49:27 -0400 (EDT) To: Florian Weimer cc: pgsql-sql@postgresql.org Subject: Re: Determining if two subnets intersect In-reply-to: References: Comments: In-reply-to Florian Weimer message dated "23 Jul 2001 18:56:45 +0200" Date: Wed, 25 Jul 2001 02:49:26 -0400 Message-ID: <20287.996043766@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200107/332 X-Sequence-Number: 4145 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 regards, tom lane