Received: from druid.net (druid.net [216.126.72.98]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fBEF3Wm99048 for ; Fri, 14 Dec 2001 10:03:32 -0500 (EST) (envelope-from darcy@druid.net) Received: by druid.net (Postfix, from userid 1000) id D39761A69; Fri, 14 Dec 2001 10:03:39 -0500 (EST) Subject: Re: cidr question To: mislam@mindspring.com (Mir S Islam) Date: Fri, 14 Dec 2001 10:03:39 -0500 (EST) Cc: pgsql-sql@postgresql.org In-Reply-To: from "Mir S Islam" at Dec 12, 2001 05:38:27 PM X-Mailer: ELM [version 2.5 PL5] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20011214150339.D39761A69@druid.net> From: darcy@druid.net (D'Arcy J.M. Cain) X-Archive-Number: 200112/147 X-Sequence-Number: 5970 Thus spake Mir S Islam > maybe I am not understanding it right. Here is my problem. > > I have a table like this > > Attribute | Type | Modifier > --------------+--------------------------+---------- > ip | cidr | not null > > with following rows > ip > --------------- > 10.0.0.1/32 > 10.0.0.50/32 > 10.0.0.255/32 > 11.0.0.0/32 > 11.0.1.200/32 > 11.0.1.20/32 > (6 rows) > > should not the command > DELETE from ip_space where ip = '11.0.1.0/24'::cidr > delete last two rows ? But it does not delete anything. Basically I would > like to be able to delete a whole range or block of ip/network addresses. What you want is the "Contained within" operator. Note the different outputs from these two queries. select '11.0.1.200/32'::cidr << '11.0.1.0/24'::cidr; select '11.0.1.200/32'::cidr << '11.1.1.0/24'::cidr; -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.